Get plan&io&time by iSql command
2009-02-04 13:04
441 查看
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(); }
相关文章推荐
- time.GetAsSystemTime(cmdheader.commandtime);//BOOL RES = time.GetAsSystemTime(timeDest);无效
- How to get Time Separator in Jav…
- undefined reference to `clock_gettime'
- 2017 Multi-University Training Contest - Team 4:1011&hdu6077、Time To Get Up
- javascript在html中的加载顺序------为什么window.alert(document.getElementById("time").innerTex)无法弹出对话框
- 解决多线程中spInputElement.GetPropertyByName( L"name", &vName )导致崩溃
- if (this.getEntitiesByType('EntityPlayer').length < 1)
- Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the ser
- getElementsByClassName的用法 和 …
- error: implicit declaration of function 'gettimeofday'
- Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the ser
- "Unable to get image data from canvas because the canvas has been tainted by cross-origin data"问题产生原
- Linux gets hit by a trojan -- it's time to sudo apt-get scared!
- 解决方法!:getImageData on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
- etElementByID getElementsBy…
- undefined reference to `clock_gettime' 链接错误的解决方案
- getElementByID&nbsp;getElementsByName…
- (.text+0xb3a): undefined reference to `clock_gettime'
- golang go get出现"go: missing Git command"异常
- 离开图形界面的那些日子 之二:Oracle 11.2.0.3 instance & database upgrade by Command Line