Oracle's JDBC driver's PreparedStatement.cancel() doesn't work

From: Joseph Weinstein <joe_at_bea.com.remove.this>
Date: Wed, 11 Dec 2002 20:02:09 -0800
Message-ID: <3DF80A40.473B38B1_at_bea.com.remove.this>


Hi all.

   I'm having problems with Oracle's JDBC driver and wonder if Oracle knows of this and whether they have an opinion on it. The thin driver's PreparedStatement.cancel() doesn't work according to the JDBC spec.

In my applicaton, one thread may be doing a transaction and may execute a PreparedStatement to do an update, which happens to hang because the DBMS datum is already locked by another session. In some cases, after a time my coordinator thread may want to cancel that thread's pending statement execution and roll back it's transaction. I have found that if the application threaad is using a plain java.sql.Statement, this will work, but if it's using a PreparedStatement, the cancel has no effect on the PreparedStatement executeUpdate() call, and doesn't return control to the application thread. If I then try to do a Connection.rollback(), that call also hangs

indefinitely until the other session that had the lock, releases it.

   I note that Statement.setQueryTimeout() also does not work in this case, as it is implemented internally as a thread that calls cancel() after the timeout...

[Quoted] Thanks in advance for any confirmation or workaround,

Joe Weinstein Received on Thu Dec 12 2002 - 05:02:09 CET

Original text of this message