Can SQL Developer's Cancel Button reliably stop server‑side processing across JDBC driver versions?
0 reputation · 28 Mar 2021, 11:31 UTC
0 reputation · 28 Mar 2021, 11:31 UTC
SQL Developer’s worksheet toolbar offers a Cancel button that invokes JDBC Statement.cancel(). The effectiveness of this call varies with Oracle JDBC driver version and the type of statement being executed. In addition, the SQL Execution Timeout setting in Tools → Preferences → Database → Advanced imposes a client‑side limit; when exceeded, SQL Developer attempts to cancel the statement, but the server may still be busy until the next network round‑trip.
Because driver support for Statement.cancel() is not guaranteed for all operations, and because a cancelled statement does not automatically roll back the surrounding transaction, users observe inconsistent behavior across SQL Developer releases (e.g., 21.4 vs 23.1) and driver types.
Which driver versions provide reliable cancellation for long‑running SELECT and PL/SQL statements?
Does the SQL Execution Timeout always trigger a rollback of any open transaction when a statement is cancelled?
34775 reputation · 28 Mar 2021, 16:34 UTC
Oracle thin JDBC driver 12.1.0.2 and later (including 19c, 21c, 23c) reliably cancel long-running SELECT statements and most PL/SQL blocks via Statement.cancel(). Drivers 11.2.0.4 and earlier frequently ignore cancellation for PL/SQL and may only stop after the current fetch completes. The SQL Execution Timeout preference does not roll back open transactions; it only issues a client-side Statement.cancel(), leaving any transaction active until an explicit ROLLBACK or session termination.
| Driver Version | SELECT Cancellation | PL/SQL Cancellation | Notes |
|---|---|---|---|
| 12.1.0.2+ (19c, 21c, 23c) | Reliable | Reliable for most blocks | Requires dedicated server connection; shared server/RAC may delay |
| 11.2.0.4 and earlier | Works after current fetch | Often ignored | Inconsistent across SQL Developer releases (21.4 vs 23.1) |
ojdbc8.jar 19.3.0.0).SELECT * FROM large_table WHERE rownum <= 1000000BEGIN FOR i IN 1..100 LOOP DBMS_LOCK.SLEEP(1); END LOOP; END;V$SESSION for status and V$TRANSACTION for open transactions after cancel.ojdbc6.jar 11.2.0.4) to compare.Are you using a dedicated server or shared server (MTS) connection? Shared server architectures can delay or prevent cancellation until the request reaches a dispatcher, which changes the reliability expectation regardless of driver version.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.