Subject Re: [firebird-support] Application Not detecting Server Stopped
Author Helen Borrie
At 10:42 AM 2/03/2004 +0000, you wrote:
>I have been running firbird 1.0.3 sucessfully, however I am writing
>code to re-connect to the database after the connection has been
>lost. The first time the conection has been lost I can disconnet
>sucessfully however, if it drops for a second time I get an access
>violation on the 'isc_detach' function of the GDS dll.
>I have since upgraded to firbird 1.5 to see if this have been fixed
>in the newer version, then stopped the firbird server but the
>application does not get a message saying that the server has stopped

When you turn off the tap, the water stops flowing.

There's no point in trying to use the connection. The client won't know
that it's disconnected unless it tries to talk to the server.
So do a low-impact query. Then, you should get an exception, which you
handle *first*, then use ForceDisconnect to reset the client. This will
invalidate the now unreferenced connection handle and you'll be ready to
connect again.

I use a call to IB_Connection.Gen_ID(MickeyMouse,0), but anything
"harmless" to the state of your app will do to raise the exception.