Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLLoader 704 Internal error while loading through JAVA

Getting following error on executing sqlldr command.

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

Following is the sqlldr cmd :

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

Note :- When executing the same through command prompt its getting succes.

Following is the code snipt i tried.

            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();
            }
like image 400
Rakesh KR Avatar asked Jun 24 '26 11:06

Rakesh KR


1 Answers

I think error could be in your username - "Bill!ng@123#". Check out the quotes escaping rules in Java. Like:

String str = "BILLING/'\"Bill!ng@123#\"'@10.113.242.162:1521";
like image 60
BSeitkazin Avatar answered Jun 27 '26 00:06

BSeitkazin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!