在JDBC中停止或终止长时间运行的查询 [英] Stop or terminate long running query in JDBC
问题描述
有没有办法在JDBC中停止或终止长时间运行的Oracle查询?它经常以重启应用程序服务器结束,以使jdbc与Oracle DB断开连接。
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.
在Java或JDBC中寻找类似于SQL Plus的功能 - 杀死会话
Looking for functionality similar to SQL Plus - Kill session
in Java or JDBC
SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';
在java中执行的任何线索?
any clue to perform in java ?
推荐答案
可能有点偏,但我建议使用相反,JDBC超时。它具有实际优先终止而不是强制终止的额外好处。
Possibly bit off, but I would propose using JDBC Timeout instead. It has the added benefit of actually terminating gracefully instead of by force.
使用现代应用服务器,您通常可以从数据源配置定义JDBC超时。
With modern app servers you can usually define JDBC timeout from datasource configuration.
这篇关于在JDBC中停止或终止长时间运行的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!