加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle executeBatch异常 ArrayIndexOutOfBoundsException

发布时间:2020-12-12 13:16:51 所属栏目:百科 来源:网络整理
导读:使用ojdbc14?10.2.0.4 进行批量写入数据到oracle时,写入的字段有140个,每1000条执行一次executeBatch,日志中出现大量异常ArrayIndexOutOfBoundsException信息,具体以下: java.lang.ArrayIndexOutOfBoundsException: -32377 at oracle.jdbc.driver.Oracl

使用ojdbc14?10.2.0.4 进行批量写入数据到oracle时,写入的字段有140个,每1000条执行一次executeBatch,日志中出现大量异常ArrayIndexOutOfBoundsException信息,具体以下:

java.lang.ArrayIndexOutOfBoundsException: -32377
    at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2673)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10689)

从日志信息来看,应该是oralce jdbc驱动内部setupBindBuffers方法中出现了数组越界异常。在网上找到一个帖子,通过他的思路得到了解决方案。

The 10g driver apparently keeps a global serialnumber for all parameters in the entire batch,with a "short"variable. So you can have at most 32768 parameters in the batch. I was havingthe same exception because I have a
?INSERT statement with 42 parameters and mybatches can be as big as 1000 records,so 42000 > 32768 and this overflowsto a negative index. I reduced the batch factor to 100 to be safe,and all iswell. I guess your update DML should have a larger number of parameters
?perrecord,right? (My diagnostic of the bug is just deduction from the symptoms) 地址:https://community.oracle.com/thread/599441?start=15&tstart=0 ? 按照这个思路,将addBatch的数量减少到100,使每次executeBatch的参数值小于32768,发现异常解决。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读