oracle 执行批处理sql,部署遇到的驱动不兼容问题
同一份代码,部署到两个测试环境,一个运行正常一个运行报错,错误信息如下:
PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; executeBatch, Exception = -32713; nested exception is java.sql.SQLException: executeBatch, Exception = -32713 org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; executeBatch, Exception = -32713; nested exception is java.sql.SQLException: executeBatch, Exception = -32713 java.sql.SQLException: executeBatch, Exception = -32713 at weblogic.jdbc.wrapper.JDBCWrapperImpl.invocationExceptionHandler(JDBCWrapperImpl.java:141) at weblogic.jdbc.wrapper.PreparedStatement.executeBatch(PreparedStatement.java:201) at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:792) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:490) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:518) at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:783) at com.hollycrm.cpems.thirdparty.syncData.service.DepositDeliverSyncDataService.syncData(DepositDeliverSyncDataService.java:83) at com.hollycrm.cpems.thirdparty.syncData.service.DepositDeliverSyncDataService.execute(DepositDeliverSyncDataService.java:55) at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:291) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:163) at $Proxy120.execute(Unknown Source) at com.hollycrm.cpems.thirdparty.syncData.SyncDataMamager$1.run(SyncDataMamager.java:25) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.ArrayIndexOutOfBoundsException: -32713 at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2677) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9270) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210) at weblogic.jdbc.wrapper.PreparedStatement.executeBatch(PreparedStatement.java:191) ... 14 more
经过分析查找原因,参考:https://forums.oracle.com/forums/thread.jspa?messageID=8393003
觉得这个不是代码问题,而是数据库驱动问题,weblogic配置数据源选择的驱动与测试环境所使用的oracle版本不一致导致的。
解决办法:
1.从oracle服务器安装目录jdbc驱动目录下获取对应版本的数据库驱动,拷贝到weblogic部署域下lib目录下
2.重新设置weblogic数据源,选择驱动类型为oracle other类型
3.设置weblogic部署域下bin/setDomainEnv.sh 把匹配版本的ojdbc驱动路径加入CLASSPATH。
4.重新启动服务
相关推荐
smalllove 2020-11-03
wuhuaguwuhuaguo 2020-09-15
guying 2020-08-16
wqcong 2020-06-14
chenzhiwei 2020-06-13
talkingDB 2020-05-05
83206837 2020-05-01
Yasin 2020-03-03
Amzaing00 2020-01-06
GechangLiu 2020-01-05
shenghua 2013-03-27
文山羊 2019-12-16
乾坤一碼農 2019-12-11
dongxurr 2019-12-09
bluestartlxp 2019-11-27
86427217 2015-04-18
thankinglove 2015-09-06
圆圆的世界CSDN 2019-11-07
longxiang 2010-04-07