This problem still exists in MySQL-AB JDBC Driver mysql-connector-java-5.1.6 connecting to
MySQL 5.0.27. The following code (JSP for convenience) will illustrate the problem after a
duration longer than the server's connection timeout.
After the timeout the query hangs indefinitely; instead I believe it should be possible
to detect that the connection is invalid by setting the Socket.setSoTimeout(int timeout)
parameter (e.g read-timeout) to be equal (or slightly larger) to the
Statement.getQueryTimeout()*1000 value. However Statement.setQueryTimeout(int secs) does
not result in the throwing of an SQLException (only an indefinate wait).
The server indeed appears not to have correctly closed the connection (netstat show
connected); however the driver should still be able to dtect the response timeout (for
the incorrect socket shutdown in addition to normal query timeouts)