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);
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.056 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.