Click to See Complete Forum and Search --> : How to detect a broken connection?


Spotnick2
October 2nd, 2001, 02:00 PM
I have one question simple.

I have a service which checks a database for new entries and scan at 30 secs intervals. If I reboot the SQL Server, this service crashes, even if I have error handling.

My question is, is there a way to detect when the connection is OPENED that the server is not accessible and make it wait? I tought this was the connection timeout thing, but it doesn't seem it works when the connection is already established.

Thank you!

Iouri
October 2nd, 2001, 02:14 PM
We can find if we have opened Db by the state of the connection object

adStateOpen
adStateClosed
adStateConnecting

for example:
If cnConnection.State = adStateOpen then
cnConnection.Close
else
msgbox "Connection is lost"
End If
set cnConnection = nothing







Iouri Boutchkine
iouri@hotsheet.com

Spotnick2
October 2nd, 2001, 02:15 PM
Of course this was my first idea.. but the connection state is still Opened..