BEA WebLogic 814中Blog对象插入时问题的原因:Oracle驱动

来源:互联网 发布:seo考试 编辑:程序博客网 时间:2024/06/06 06:30

数据库 oralce 9i 版本9.2.0.1.0
Server: Weblogic 814
数据库连接方式:Hibernate3+DataSource + ConnectionPool

问题:
往数据库中某表插入Blog对象时偶尔(并不是每次都,现象是第一次不出错,之后每次都出错)出错,错误异常:
{org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Could not execute JDBC batch update: encountered SQLException [ORA-01483: invalid length for DATE or NUMBER bind variable]; nested exception is java.sql.BatchUpdateException: ORA-01483: invalid length for DATE or NUMBER bind variable.
java.sql.BatchUpdateException: ORA-01483: invalid length for DATE or NUMBER bind variable

原因分析:
出现这个问题后,使用spring提供的org.springframework.jdbc.datasource.DriverManagerDataSource连数据库执行相同的操作并没有问题,由于使用的是server上配置的DataSource+ConnectionPool,数据库驱动的获取是server选择的。经查找,server选择的是%bea_home%/weblogic81/server/lib/ojdbc14.jar (version 10.1.0.6.0)。用类路径里的驱动替代,该问题不再出现。

解决办法:使用version为10.1.0.4.0的ojdbc.jar代替%bea_home%/weblogic81/server/lib/ojdbc14.jar。

原创粉丝点击