ERROR - [jcc][t4][2030][11211][3.50.152]在对连接的底层 socket执行操作期间发生通信错误

程序操作DB2时报以下ERROR,请求高手帮助
ERROR - [jcc][t4][2030][11211][3.50.152] 在对连接的底层 socket、socket input stream 或 socket output stream 执行操作期间
发生通信错误。错误位置:Reply.fill()。消息:Software caused connection abort: recv failed。 ERRORCODE=-4499, SQLSTATE=08001
ERROR - could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query
ERROR - [jcc][t4][10335][10366][3.50.152] 操作无效:连接已关闭。 ERRORCODE=-4470, SQLSTATE=08003
ERROR - [jcc][t4][10335][10366][3.50.152] 操作无效:连接已关闭。 ERRORCODE=-4470, SQLSTATE=08003
ERROR - could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query
ERROR - Class ADSyncServiceImpl Method saveList : a different object with the same identifier value was already associated with the session: [com.zony.dms.entity.ADOU#0]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.zony.dms.entity.ADOU#0]
ERROR - [jcc][10120][10943][3.50.152] 操作无效:已关闭 statement。 ERRORCODE=-4470, SQLSTATE=null

不知不觉已过了三年~

原因:Hibernate 访问数据库时使用了 PreparedStatement 对象,在释放资源时调用 PreparedStatement 的
getQueryTimeout() 和 setQueryTimeout() 方法,但 JDBC-ODBC 没有实现这个方法,故抛出如上的异常。

解决方法:找到 org.hibernate.jdbc 包下的 AbstractBatcher 类,在
closeStatement(PreparedStatement ps) 方法中注释掉这一行:// if ( ps.getQueryTimeout()!=0 )
ps.setQueryTimeout(0);
温馨提示:答案为网友推荐,仅供参考