File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Lost connection detection time difference" Watch "Lost connection detection time difference" New topic

Lost connection detection time difference

Neil Gow

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.


Jan Cumps

Joined: Dec 20, 2006
Posts: 2565

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

OCUP UML fundamental and ITIL foundation
Neil Gow

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:
subject: Lost connection detection time difference
It's not a secret anymore!