Oracle connection / query timeout
2 answers
If you are executing a request in the context of a transaction, the JTA TP Monitor Transaction Timeout value will determine the request timeout value. The configuration for this depends on one application server from another.
On a query-by-query basis (if no JTA TP monitor is available), the setQueryTimeout method can be used to set a timeout when a Statement / PreparedStatement / CallableStatement is executed.
Update
setQueryTimeout should not be relied upon, although it does work (at least from a J2SE client). It works through a JDBC driver doing a full round to the Oracle database server. Then to make the database stop executing the query, the database. Don't rely on it for mission-critical applications.
+5
source to share