How to use the JDBC setQueryTimeout Call to Cancel a Long Running Query and raise an ORA-1013
(Doc ID 412171.1)
Last updated on MARCH 29, 2018
Applies to:JDBC - Version 10.2.0.3 to 126.96.36.199.0 [Release 10.2 to 12c]
Information in this document applies to any platform.
This article provides a very simple JDBC standalone program to demonstrate the use of the JDBC standard method setQueryTimeout() which is available for all JDBC java.sql.Statement objects. The article will also discuss limitations that may prevent the setQueryTimeout() from working properly due to limitations of both the database and the JDBC driver.
The Statement.setQueryTimeout(int seconds) relies on the Statement.cancel() method and basically implements a thread to cancel a long running query after a specified delay.
This demonstration builds on <Note 357615.1> How to simulate a slow query. Useful for testing of timeout issues
This program has been tested using RDBMS 10.2.0.3 ( Linux x86 32-bit) JDBC/thin 10.2.0.3, JDBC/thin 188.8.131.52, JDBC/thin 184.108.40.206 and JDK 1.5 / 1.6 ( Windows client), and JDBC 12c.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document