Tag Archives: Message 2100 not found

Java calls sqlldr and reports an error: Message 2100 not found

Java calls the sqlldr command of Oracle and reports an error: Message 2100 not found; No message file for product=RDBMS, facility=ULMessage 2100 not found; No message file for product=RDBMS, facility=UL

Manually executing sqlldr can be executed normally, but if it is placed in Java, the above 2100 error will be reported

I’ve been looking for mistakes for two days

Hope to help and record this problem

Sort out the solutions (two kinds) here (first say your own, and then summarize what Baidu has found)

1. Let’s talk about my problems first

Let’s start with the conclusion: you can execute sqlldr manually, but you need to set environment variables in Java( I don’t know much about Java. At least the problem will be solved after I set it like this.)

The line of runtime. Getruntime(). Exec (CMD) found on the Internet can execute sqlldr. The method is correct, but it seems that it has not been written, and the environment variable needs to be set

 

String[] cmd = { "/bin/bash", "-c", "echo $ORACLE_HOME;echo $LD_LIBRARY_PATH;$ORACLE_HOME/bin/" + shellCommand };

final Process pid = Runtime.getRuntime().exec(cmd,new String[] { "ORACLE_HOME=/oracle/app/oracle/product/11.2.0.4/dbhome/",
            "LD_LIBRARY_PATH=/usr/local/lib:/oracle/app/oracle/product/11.2.0.4/dbhome/lib:$LD_LIBRARY_PATH" });
            Process pid = Runtime.getRuntime().exec(cmd
            System.out.println("Process pid" + pid);
            bufferedReader = new BufferedReader(new InputStreamReader(pid.getErrorStream()), 1024);

Just add these lines

The full code is as follows:

public static int executeShellsetHome(String shellCommand) {
        int success = -1;
        BufferedReader bufferedReader = null;
        String[] cmd = { "/bin/bash", "-c", "echo $ORACLE_HOME;echo $LD_LIBRARY_PATH;$ORACLE_HOME/bin/" + shellCommand };
        try {
            System.out.println("run  executeShellsetHome");
            final Process pid = Runtime.getRuntime().exec(cmd,new String[] { "ORACLE_HOME=/oracle/app/oracle/product/11.2.0.4/dbhome/",
            "LD_LIBRARY_PATH=/usr/local/lib:/oracle/app/oracle/product/11.2.0.4/dbhome/lib:$LD_LIBRARY_PATH" });
            Process pid = Runtime.getRuntime().exec(cmd
            System.out.println("Process pid" + pid);
            bufferedReader = new BufferedReader(new InputStreamReader(pid.getErrorStream()), 1024);
            pid.waitFor();
            success = pid.exitValue();
            if(0==success){
                System.out.println("sqlldr success");
            }
            else  {
                String line = null;
                String errorMsg = "";
                while (bufferedReader != null && (line = bufferedReader.readLine()) != null) {
                    errorMsg += line;
                }
                throw new Exception("run" + shellCommand + "error" + errorMsg);
            }
            

        } catch (Exception ioe) {
            ioe.printStackTrace();
            System.out.println("Exception");
        } finally {
            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }

            }
            
        }
        return success;
    }

 

2. The remaining issues are related to permissions

$ORACLE_Permissions for home/RDBMS/MESG/oraus.msg and oraus.msb   ( It is also said that only one permission of oraus.msb needs to be changed (specific self-test is required)

It is also possible to put these two files in the upper directory, that is, $oracle_Home/RDBMS/and give sufficient permissions

If there is any mistake, please help correct it and discuss it together if there is a problem