开发者

JDBC setQueryTimeout not working?

I'm querying MSSQL 2008 server thourgh JAVA, using the JDBC driver. I do something like this:

PreparedStatement stmt = ...;
...
stmt.setQueryTimeout(60);
stmt.executeQuery();

I see that when there开发者_Go百科'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?

Thanks.


  • The timing for setQueryTimeout is not precise at all
  • The exception relies on the server acknowledging the cancel command

So, YMMV unfortunately...

References: (can't find anything better, sorry)

  • 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜