Ant 1.8.2 is deployed on machine 241 and oracle 11g is deployed on machine 242. the following error is reported when ant 1.8.2 is used to insert data to the oracle 11G environment through the oracle DRIVER:
builddb:BUILD FAILED/home/build.xml:10: java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1ORA-12705: Cannot access NLS data files or invalid environment specified at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:28 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278) at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:785) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) at org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:370) at org.apache.tools.ant.taskdefs.SQLExec.getConnection(SQLExec.java:942) at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:614) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at java.lang.reflect.Method.invoke(libgcj.so.7rh) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:809) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)Total time: 2 seconds
According to the "ORA-12705" error number Baidu, found that many people give the following solutions:
. Check whether the following variables are set correctly (invalid environment specified) NLS_LANG, ORA_NLSxx, or ORACLE_HOME2. check whether the nlb file (nls data files) in the $ ORACLE_HOME/NLS/data directory is damaged. You can back up the file first, copy these files from other identical environments. solution 1 is ruled out because the environment variables have never been changed before. the amazing discovery of the $ ORACLE_HOME directory surprised me both the surprise and the excitement. the surprise was that the NLS directory was lost, and I was excited that I had another machine installed with Oracle11g. it seems that the operating system has been close to each other in the past few years. Needless to say, copy one copy.
According to the preceding solution, check the "NLS_LANG, ORA_NLSxx, or ORACLE_HOME" parameter of the oracle server (242). If the first two parameters are not set, set these two parameters, the problem persists (the problem persists after the machine is restarted ).
So I found the third machine (marked as the 243 machine) and executed the same ant script on the 243 machine. I found that the script can be correctly executed. It is initially suspected that the environment variables of machines 241 and 243 are different. By using the env command, we compared the environment variables of the two machines, and found that machine 243 has set java_home, and 241 machine does not set java_home, so quickly set java_home value (java_home settings reference: http://blog.csdn.net/wgw335363240/article/details/22079311 ). Then, disconnect the previous connection, create a new connection, execute the ant command, and the data is inserted successfully.
Summary:Here took a detour, mainly ORA-12705 error to give too much error information, during the attempt to read the jdbc driver, did not find any special problem. When key information cannot solve the problem, the stupid method (comparative method) is often very effective.