java.io.IOException:无法运行程序" sqlldr":error = 2,路径名中的文件或目录不存在

时间:2017-03-24 09:23:41

标签: java oracle aix

我尝试将SQL * Loader导入数据用于Oracle。具体方法是我创建一个Java类来调用" sqlldr"。我的方法摘录如下:

public class SqlldrImportDataFile {
  public String executeImport(String user, String password, String database,String fileRoute, String ctlfileName, 
        String logsRoute,String logfileName) {
    InputStream ins = null;
    String dos = "sqlldr " + user + "/" + password + "@" + database + " control=" + fileRoute + ctlfileName + " log=" + logsRoute + logfileName;
    String returnCode = "0";
    try {
        Process process = Runtime.getRuntime().exec(dos);
        ins = process.getInputStream();

        BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
        String line = null;
        while ((line = reader.readLine()) != null) {
            String msg = new String(line.getBytes("ISO-8859-1"), "UTF-8");
        }

        int exitValue = process.waitFor();

        process.getOutputStream().close();
        reader.close();
        ins.close();
    } catch (Exception e) {
        return "-1";
    }
    return returnCode;
}

}

然而,当我运行应用程序时会出现问题,这是" java.io.IOException: Cannot run program "sqlldr": error=2, A file or directory in the path name does not exist."详细错误信息如下:

java.io.IOException: Cannot run program "sqlldr": error=2, A file or directory in the path name does not exist.
at java.lang.ProcessBuilder.processException(ProcessBuilder.java:489)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
at java.lang.Runtime.exec(Runtime.java:604)
at java.lang.Runtime.exec(Runtime.java:442)
at java.lang.Runtime.exec(Runtime.java:339)
at com.sdb.bbcp.common.SqlldrImportDataFile.executeImport(SqlldrImportDataFile.java:188)
at com.sdb.bbcp.common.SqlldrImportDataFile.execute(SqlldrImportDataFile.java:80)
at com.sdb.common.flow.SDBEMPFlow.execute(SDBEMPFlow.java:175)
at com.ecc.emp.flow.Operation.execute(Operation.java:96)
at com.ecc.emp.flow.EMPBusinessLogic.execute(EMPBusinessLogic.java:89)
at com.ecc.emp.processor.EMPBusinessLogicCaller.execute(EMPBusinessLogicCaller.java:112)
at com.sdb.common.flow.SDBEMPFlow.execute(SDBEMPFlow.java:175)
at com.ecc.emp.flow.Operation.execute(Operation.java:96)
at com.ecc.emp.flow.EMPBusinessLogic.execute(EMPBusinessLogic.java:89)
at com.ecc.emp.processor.EMPBusinessLogicCaller.execute(EMPBusinessLogicCaller.java:112)
at com.sdb.common.flow.SDBEMPFlow.execute(SDBEMPFlow.java:175)
at com.ecc.emp.flow.Operation.execute(Operation.java:96)
at com.ecc.emp.flow.EMPBusinessLogic.execute(EMPBusinessLogic.java:89)
at com.sdb.bbcp.communication.BBCPTCPIPRequestService.handleRequest(BBCPTCPIPRequestService.java:190)
at com.sdb.bbcp.communication.BBCPTCPIPServiceServlet.processNewPackage(BBCPTCPIPServiceServlet.java:505)
at com.ecc.emp.tcpip.TCPIPService.processNewPackage(TCPIPService.java:652)
at com.ecc.emp.tcpip.TCPIPService.newPackageReceived(TCPIPService.java:567)
at com.ecc.emp.tcpip.SocketProcessThread.runTask(SocketProcessThread.java:127)
at com.ecc.emp.tcpip.SocketProcessThread.run(SocketProcessThread.java:107)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Thread.java:784)

我从互联网上搜索过多的资源。我检查服务器的环境,通过写入" sqlldr"来执行命令。 shell ...但直到错误。

  • 用户:用户名
  • 服务器:AIX 7.1.0.0
  • $ ORACLE_HOME = / ORACLE /../产品/ 10.2.0
  • $ PATH =:$ ORACLE_HOME / bin中:
  • chown -R username / oracle /
  • 用户组:员工系统dba

那我该怎么办? 附:该应用程序通常在我们的其他机器上工作。

0 个答案:

没有答案