Original address: http://yanwushu.sinaapp.com/oracle_executebatch_arrayindexoutofboundsexception/
When using the JDBC Interface Preparedstatement.executebatch () to execute SQL in bulk in Oracle, an exception arrayindexoutofboundsexception occurs with the following information:
Java.lang.ArrayIndexOutOfBoundsException: -32413 at Oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers (oraclepreparedstatement.java:2672) Atoracle.jdbc.driver.OraclePreparedStatement.executeBatch (oraclepreparedstatement.java:10688) Atcom.keyi.xxx.dal.xx.importFile (publiccustomerimportdao.java:107)
Looks like the Oralcejdbc driver. An array out-of-bounds exception occurred in the internal Setupbindbuffers method, but what caused the exception to occur has not been clear. Found a post on the Internet, through his ideas to get a solution.
The post content is as follows:
The 10g driver apparently keeps a global serialnumber for all parameters in the entire batch, with a "short" variable. So can has at most 32768 parameters in the batch. I was havingthe same exception because I had a INSERT statement with the parameters and mybatches can be as big as the RE Cords, so 42000 > 32768 and this overflowsto a negative index. I reduced the batch factor to is safe, and all Iswell. I guess your update DML should has a larger number of parameters Perrecord, right? (My diagnostic of the bug is just deduction from the symptoms)
The Post address is:https://community.oracle.com/thread/599441?start=15&tstart=0
In general, Oracle's PreparedStatement has an upper limit on the number of parameters when executing SQL in bulk ( for different versions of the Oracle driver, this upper limit may be different for different), The number of this parameter refers to the number of addbatch * number of arguments in each SQL . For Oracle 10g drivers, this value may be 32768, sothe number of addbatch per The number of parameters in SQL should be less than this value, or error.
According to this idea, the Addbatch reduce the number of times, making each ExecuteBatch The parameter value is less than 32768 , and found the exception resolved.
Oracle ExecuteBatch Exception: ArrayIndexOutOfBoundsException