Get plan&io&time by iSql command

here is the main code:

 

public static void ExecuteSQL(String database, String sql) throws IOException { Runtime runtime = Runtime.getRuntime(); StringBuffer command = new StringBuffer(); command.append("set showplan on /n"); command.append("set statistics io on /n"); command.append("set statistics time on /n"); command.append("set statistics simulate on /n"); // command.append("set noexec on /n"); command.append("use "); command.append(database); command.append(" /n"); command.append("go /n"); command.append(sql); command.append("/n"); command.append("set statistics io off /n"); command.append("set statistics time off /n"); command.append("set showplan off /n"); command.append("set statistics simulate off /n"); // command.append("set noexec off /n"); command.append("go /n"); command.append("quit /n"); command.append("go /n"); BufferedWriter writer; BufferedReader reader; Process p = runtime.exec("isql -SEUDB_US_DEV -Uwlsuser -Psynnex"); writer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream())); writer.write(command.toString()); writer.flush(); reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while ((line = reader.readLine()) != null) { System.out.println(line); getIOAndTime(line); } reader.close(); writer.close(); }

你可能感兴趣的:(String,IO,command,database,Go,statistics)