JDBC setQueryTimeout无法正常工作? [英] JDBC setQueryTimeout not working?
本文介绍了JDBC setQueryTimeout无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用JDBC驱动程序查询MSSQL 2008服务器服务器JAVA. 我做这样的事情:
I'm querying MSSQL 2008 server thourgh JAVA, using the JDBC driver. I do something like this:
PreparedStatement stmt = ...;
...
stmt.setQueryTimeout(60);
stmt.executeQuery();
我看到当SQL服务器上有负载时,即使超时已经过去,该语句也不会被取消.
I see that when there's a load on the SQL server, the statement doesn't get cancelled even though the timeout has passed.
有人对此有任何线索吗?
Does anyone have a clue about this?
谢谢.
推荐答案
- setQueryTimeout的时间根本不精确
- 该异常依赖于服务器确认取消命令
- http://social.msdn.microsoft.com/Forums/zh-CN/sqldataaccess/thread/06bea9b9-78cb-4d1b-8c12-5f06ed991cac/
- http://www. sqlmonster.com/Uwe/Forum.aspx/sql-server-jdbc/1017/setQueryTimeout-not-work
- http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/06bea9b9-78cb-4d1b-8c12-5f06ed991cac/
- http://www.sqlmonster.com/Uwe/Forum.aspx/sql-server-jdbc/1017/setQueryTimeout-not-work
很遗憾,YMMV ...
So, YMMV unfortunately...
参考:(找不到更好的对不起)
References: (can't find anything better, sorry)
这篇关于JDBC setQueryTimeout无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文