gpt4 book ai didi

java - 通过 JAVA 加载时出现 SQLLoader 704 内部错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:45:08 24 4
gpt4 key购买 nike

执行 sqlldr 命令时出现以下错误。

SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12154: TNS:could not resolve the connect identifier specified

以下是 sqlldr 命令:

sqlldr BILLING/'"Bill!ng@123#"'@10.113.242.162:1521/bssstc control=/log/bssuser/CDR/Postpaid_CDR_Log/CTRL_File.ctrl log=/log/bssuser/CDR/Postpaid_CDR_Log/LOG_File.log direct=false silent=header skip_unusable_indexes=true rows=200000 bindsize=20000000 readsize=20000000 ERRORS=25000

注意:- 当通过命令提示符执行相同操作时,它会成功。

以下是我试过的代码片段。

            Runtime rt   = Runtime.getRuntime();
Process proc = null;
try {
proc = rt.exec(sqlLoaderCommand);

InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);

String line = null;
while ((line = br.readLine()) != null){
logger.info(line);
}
int exitVal = proc.waitFor();
logger.info("Process exitValue: " + exitVal);
int returnValue = proc.exitValue();
String str = null;

if (returnValue != 0) {
InputStream in = proc.getInputStream();
InputStreamReader preader = new InputStreamReader(in);
BufferedReader breader = new BufferedReader(preader);
String msg = null;
while ((msg = breader.readLine()) != null) {
logger.info(msg);
str = str + msg;
}
System.out.flush();
preader.close();
breader.close();
in.close();
InputStream inError = proc.getErrorStream();
InputStreamReader preaderError = new InputStreamReader(inError);
BufferedReader breaderError = new BufferedReader(preaderError);


String errorMsg = null;
while ((errorMsg = breaderError.readLine()) != null) {
logger.info("Copy Error: " + errorMsg);
str = str + errorMsg;
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}

最佳答案

我认为错误可能出在您的用户名中 - “Bill!ng@123#”。查看 Java 中的引号转义规则。喜欢:

String str = "BILLING/'\"Bill!ng@123#\"'@10.113.242.162:1521";

关于java - 通过 JAVA 加载时出现 SQLLoader 704 内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55587319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com