Bug #9906 | Connector/J: QueryTimeout is ignored in Statement | ||
---|---|---|---|
Submitted: | 14 Apr 2005 14:25 | Modified: | 11 Nov 2009 2:35 |
Reporter: | Stephan Fudeus | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 3.1.7 | OS: | Linux (linux) |
Assigned to: | CPU Architecture: | Any |
[14 Apr 2005 14:25]
Stephan Fudeus
[14 Apr 2005 14:49]
Mark Matthews
We can't implement this until the server does. Unfortunately, unlike other methods (such as .cancel()), the APIDOCs or the JDBC specification don't give a lot of information about what a driver should do if the operation is not supported. If we throw an exception in this case, we'll break a lot of applications that call this method that don't really require the timeout to be respected.
[15 Apr 2005 7:10]
Stephan Fudeus
Is this a feature planned for the future? Could you estimate when it will be implemented? btw: The exception-handling is inconsistent. For normal statements no SQLException is thrown (I understand your reasons). But there is the "UltraDevWorkaround"-class, which defines a callable statement. If you call setQueryTimeout() here, you will get a SQLException("Not Supported")
[1 Jul 2008 6:11]
Ken Johanson
Mark, I am curious, can this not be implemented by?: 1) timeouts less than soTimeout: long start = System.currentTimeMillis(); while (notEOS) { //read data from socket inputstream if (System.currentTimeMillis()-now>timeout) throw new SqlException("timed out"); } and also by setting the socket's soTimeout (read-timeout, case where socket is not longer valid)?: sock.setTimeout(timeout*1000); //start query try { //read data } catch (SocketTimeoutException e) { throw new SqlException("timed out"); } //end query sock.setSoTimeout(some longer/default value for pools);