简体   繁体   English

如何使用TomCat jdbc pool杀死运行超过1秒的SQL查询?

[英]How kill sql query which run more than 1 seconds with help TomCat jdbc pool?

Which of the settings of jdbc pool may help me with killing sql query which runs more than 1 seconds? jdbc池的哪些设置可以帮助我终止运行超过1秒的SQL查询?

When I say tomcat jdbc pool I mean Resource in context.xml in /tomcat/conf/ directory. 当我说tomcat jdbc pool我的意思是/tomcat/conf/目录中context.xml中的Resource。

It looks like the tomcat pool provides an out-of-the-box interceptor to do this for you. 看起来tomcat池提供了现成的拦截器来为您执行此操作。 See... 看到...

https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#org.apache.tomcat.jdbc.pool.interceptor.QueryTimeoutInterceptor https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#org.apache.tomcat.jdbc.pool.interceptor.QueryTimeoutInterceptor

You should be able to add one of these interceptors to your config 您应该能够将这些拦截器之一添加到您的配置中

(Note: that document says it is still up to the JDBC driver to enforce query timeouts. ) (注意:该文档说仍然由JDBC驱动程序来强制执行查询超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM