Is there any way to stop or terminate long running Oracle query in JDBC ? It often end up with restart application server to get jdbc to disconnect from Oracle DB.
Looking for functionality similar to SQL Plus - Kill session
in Java or JDBC
in SQL Plus
SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';
any clue to perform in java ?
short of the jdbc timeout, if you run your query in another thread, you can use Statement.cancel() to kill it.
Possibly bit off, but I would propose using JDBC Timeout instead. It has the added benefit of actually terminating gracefully instead of by force.
With modern app servers you can usually define JDBC timeout from datasource configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With