心心失意 发表于 2018-10-24 08:56:48

Java执行SQL脚本导入

String cmd = "cmd /c sqlplus usr/pwd@{//服务器IP:1521/}sid @d:\\1.sql>d:\\t.log";  
Process p = null;
  
try {
  
    p = Runtime.getRuntime().exec(cmd);
  
} catch (IOException e) {
  
    e.printStackTrace();
  
} finally {
  
    if (p != null) {
  
    try {
  
      p.waitFor();
  
    } catch (InterruptedException e) {
  
      e.printStackTrace();
  
    }
  
    p.destroy();
  
    }
  
}


页: [1]
查看完整版本: Java执行SQL脚本导入