Getting java.sql.SQLException: JZ006 JZ0C0: Connection is already closed during batch insert into Sybase

时间:2018-09-18 19:42:53

标签: java jdbc spring-jdbc sybase-ase jconnect

I am using Spring jdbc to batch insert 1.5 million records into a Sybase table. I am using JdbcTemplate.batchUpdate with a batch size of 5000. The driver is jconn4.jar. After running for ~10 minutes I get the below Exception. There are no errors in the Sybase logs. Seems like there is some kind of client timeout? Upgrading the driver is not possible.

Caused by: java.sql.SQLException: JZ006: Caught IOException: com.sybase.jdbc4.jdbc.SybConnectionDeadException: JZ0C0: Connection is already closed.
    at com.sybase.jdbc4.jdbc.ErrorMessage.createIOEKilledConnEx(ErrorMessage.java:1090)
    at com.sybase.jdbc4.jdbc.ErrorMessage.raiseErrorCheckDead(ErrorMessage.java:1131)
    at com.sybase.jdbc4.tds.Tds.handleIOE(Tds.java:5219)
    at com.sybase.jdbc4.tds.Tds.handleIOE(Tds.java:5164)
    at com.sybase.jdbc4.tds.Tds.cancel(Tds.java:2405)
    at com.sybase.jdbc4.tds.Tds.cancel(Tds.java:2329)
    at com.sybase.jdbc4.jdbc.SybStatement.doCancel(SybStatement.java:1025)
    at com.sybase.jdbc4.jdbc.SybStatement.batchLoop(SybStatement.java:2349)
    at com.sybase.jdbc4.jdbc.SybStatement.sendBatch(SybStatement.java:2157)
    at com.sybase.jdbc4.jdbc.SybStatement.executeBatch(SybStatement.java:2115)
    at com.sybase.jdbc4.jdbc.SybStatement.executeBatch(SybStatement.java:2033)
    at com.sybase.jdbc4.jdbc.SybPreparedStatement.executeBatch(SybPreparedStatement.java:2069)
    at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
    at org.springframework.jdbc.core.JdbcTemplate$5.doInPreparedStatement(JdbcTemplate.java:1038)
    at org.springframework.jdbc.core.JdbcTemplate$5.doInPreparedStatement(JdbcTemplate.java:1016)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:639)

0 个答案:

没有答案