aspose file tools*
The moose likes JDBC and the fly likes Lost connection detection time difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Lost connection detection time difference" Watch "Lost connection detection time difference" New topic
Author

Lost connection detection time difference

Neil Gow
Greenhorn

Joined: Nov 09, 2010
Posts: 2

Having a problem understanding why a broken JDBC connection is detected under Windows much quicker than it is under Linux.

I have an process that opens a connection to MSSQL using JDBC, a Stored Procedure is then executed and the result set
processed, this execute step is repeated every 60 seconds or so. If any exception is thrown then resources are closed, sleep
for 60 seconds, the connection is reopened (if fails then sleeps and repeats), once reopened the process continues. There is logging throughout
the above steps.

On Windows Vista 64bit Sun Java platform the process runs fine, if I deliberately break the connection (stop MSSQL service), the process
logs a problems within 60 seconds and starts handling the error, when the MSSQL comes back then within 60 seonds the connection is remade
and the process continues as expected.

Under Ubuntu 10 64bit both Sun and OpenJDK the process runs fine, until the connectionis broken, as it takes about 17 minutes for the exception to be thrown
for the connection broken (stopped MSSQL), as opposed to under Windows taking seconds. Once detected then the process works as expected, retrying
and reconnecting as it should.

What could be the reason for the time difference in the lost connection detection between Windows and Linux? Any help tips would be most welcome.

Thanks.

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2477
    
    7

Are you using the same protocol to connect in the two systems?


OCUP UML fundamental and ITIL foundation
youtube channel
Neil Gow
Greenhorn

Joined: Nov 09, 2010
Posts: 2
Yes the code and the connection paramters are identical, both windows and linux are connecting to the same mssql db on the same server.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lost connection detection time difference
 
Similar Threads
Tomcat 6.0.14 crash on RedHat linux 5.2 with java 1.6
Resetting a com port
database not connecting to application
Broken Pipe exception
java.net.SocketException: Broken pipe