Index: src/com/mysql/jdbc/StandardSocketFactory.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/com/mysql/jdbc/StandardSocketFactory.java (revision ) +++ src/com/mysql/jdbc/StandardSocketFactory.java (revision ) @@ -90,7 +90,13 @@ /** The underlying TCP/IP socket to use */ protected Socket rawSocket = null; + /** The connection timeout */ + int connectTimeout = 0; + + /** The socket timeout */ + int socketTimeout = 0; + - /** + /** * Called by the driver after issuing the MySQL protocol handshake and * reading the results of the handshake. * @@ -102,6 +108,7 @@ * @return The socket to use after the handshake */ public Socket afterHandshake() throws SocketException, IOException { + rawSocket.setSoTimeout(socketTimeout); return this.rawSocket; } @@ -117,6 +124,9 @@ * @return the socket to use before the handshake */ public Socket beforeHandshake() throws SocketException, IOException { + socketTimeout = rawSocket.getSoTimeout(); + if (connectTimeout != 0) + rawSocket.setSoTimeout(connectTimeout); return this.rawSocket; } @@ -189,8 +199,6 @@ .getProperty("localSocketAddress"); String connectTimeoutStr = props.getProperty("connectTimeout"); - - int connectTimeout = 0; boolean wantsTimeout = (connectTimeoutStr != null && connectTimeoutStr.length() > 0 && !connectTimeoutStr \ No newline at end of file