Skip to Content
0
Dec 08, 2021 at 11:30 AM

sybaseIQ JDBC set FetchSize can not close ResultSet

879 Views

Use jconn4.jar

connection.setAutoCommit(true);

PreparedStatement preparedStatement = connection.prepareStatement(SQL);
reparedStatement.setFetchSize(100);

preparedStatement.executeQuery();

ResultSet resultSet = preparedStatement.getResultSet();

One Thread get results from resultSet, result.next()

One Thread try to cancel query by call resultSet.close()

if set autocommit=true, will cause dead wait, cannot over thread, the stack dump is

java.lang.Thread.State: RUNNABLE

at com.sybase.jdbc4.tds.TdsProtocolContext.queueData(TdsProtocolContext.java:566)

at com.sybase.jdbc4.timedio.InStreamMgr.moreData(InStreamMgr.java:414)

at com.sybase.jdbc4.timedio.Dbio.doRead(Dbio.java:373)

at com.sybase.jdbc4.timedio.InStreamMgr.readIfOwner(InStreamMgr.java:587)

at com.sybase.jdbc4.timedio.InStreamMgr.doRead(InStreamMgr.java:319)

at com.sybase.jdbc4.tds.TdsProtocolContext.getChunk(TdsProtocolContext.java:622)

at com.sybase.jdbc4.tds.PduInputFormatter.readPacket(PduInputFormatter.java:239)

at com.sybase.jdbc4.tds.PduInputFormatter.close(PduInputFormatter.java:195)

at com.sybase.jdbc4.tds.TdsProtocolContext.close(TdsProtocolContext.java:237)

at com.sybase.jdbc4.tds.TdsProtocolContext.beginRequest(TdsProtocolContext.java:210)

at com.sybase.jdbc4.timedio.OutStreamMgr.beginRequest(OutStreamMgr.java:257)

at com.sybase.jdbc4.tds.TdsCursor.close(TdsCursor.java:614)

at com.sybase.jdbc4.jdbc.SybCursorResultSet.close(SybCursorResultSet.java:380)

at com.sybase.jdbc4.jdbc.SybResultSet.close(SybResultSet.java:293)

java.lang.Thread.State: RUNNABLE

at com.sybase.jdbc4.tds.TdsProtocolContext.queueData(TdsProtocolContext.java:550)

- locked <0x00000004e2082f18> (a com.sybase.jdbc4.tds.TdsProtocolContext)

at com.sybase.jdbc4.timedio.InStreamMgr.moreData(InStreamMgr.java:414)

at com.sybase.jdbc4.timedio.Dbio.doRead(Dbio.java:373)

at com.sybase.jdbc4.timedio.InStreamMgr.readIfOwner(InStreamMgr.java:587)

at com.sybase.jdbc4.timedio.InStreamMgr.doRead(InStreamMgr.java:319)

at com.sybase.jdbc4.tds.TdsProtocolContext.getChunk(TdsProtocolContext.java:622)

at com.sybase.jdbc4.tds.PduInputFormatter.readPacket(PduInputFormatter.java:239)

at com.sybase.jdbc4.tds.PduInputFormatter.read(PduInputFormatter.java:114)

at com.sybase.jdbc4.tds.TdsInputStream.read(TdsInputStream.java:101)

at com.sybase.jdbc4.utils.CacheStream.read(CacheStream.java:198)

- locked <0x0000000597f207d0> (a com.sybase.jdbc4.utils.CacheStream)

at com.sybase.jdbc4.utils.CacheStream.read(CacheStream.java:131)

- locked <0x0000000597f207d0> (a com.sybase.jdbc4.utils.CacheStream)

at com.sybase.jdbc4.tds.TdsDataObject.readNUMERIC(TdsDataObject.java:530)

at com.sybase.jdbc4.tds.TdsJdbcInputStream.getObject(TdsJdbcInputStream.java:1858)

at com.sybase.jdbc4.jdbc.SybResultSet.getObject(SybResultSet.java:762)

if set autocommit = false , it is work well.

so sybase IQ how to setFetchSize correctly, thanks