I get the following exception when I try to execute a expansive query on a sybase database. The funny part is the exception is not raised always but when the database is really busy/slow.

The query which i am executing selects data into a temp table, and when processing is over, drops the table. Now whenver this exception is raised, the temp table doesnot get dropped which leads to the inablilty of the application to execute further queries as the database complains that the temp table already exists. By the way, the query is preceded by a statement which should drop the temp table if it already exists. So i cant seem to figure out why the database should complain that the table already exists.


10:16:45.Thread-17.infracore.jdbc.ClsDbDataBase: SQL Exception Error Code: 0 SQL State: JZ006
Error Message : JZ006: Caught IOException: java.io.IOException: JZ0PA: The query has been cancelled and the response discarded. The cancel was probably issued by another statement on the connection.
java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0PA: The query has been cancelled and the response discarded. The cancel was probably issued by another statement on the connection.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:467)
at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:2815)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1759)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:201)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:182)
at com.sybase.jdbc2.jdbc.SybStatement.executeLoop(SybStatement.java:1596)
at com.sybase.jdbc2.jdbc.SybStatement.execute(SybStatement.java:1588)
at com.sybase.jdbc2.jdbc.SybCallableStatement.execute(SybCallableStatement.java:129)
at com.gs.cls.infracore.jdbc.ClsDbDataComm.execStatement(ClsDbDataComm.java:229)
at com.gs.cls.infracore.jdbc.ClsDbDataBase.execSql(ClsDbDataBase.java:561)
at com.gs.cls.infracore.jdbc.ClsDbDataBase.execSql(ClsDbDataBase.java:510)
at com.gs.cls.infracore.ui.ClsTableModel.loadData(ClsTableModel.java:459)
at com.gs.cls.infracore.ui.ClsTablePane$4.run(ClsTablePane.java:548)

Does someone have any idea why something like this can occur? I want to know if it is a problem with the sybase driver, or if it is a problem with my code. I found reference to the exception code JZ006 being linked to StaleConnectionException. Can someone help?