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类型
              oracle 执行批处理sql,部署遇到的驱动不兼容问题
             3.设置weblogic部署域下bin/setDomainEnv.sh 把匹配版本的ojdbc驱动路径加入CLASSPATH。
             4.重新启动服务

你可能感兴趣的:(oracle)