Page 1 of 1

Reconnect or test connection question

Posted: 08.05.2021, 14:14
by MJFShark
Hi All!

I have a situation where I'm getting a disconnected connection despite doing some attempted keep-alive pinging to the server (in this case with the OLEDB protocol to SQLServer.) What's the recommended way to handle this kind of thing as far as figuring out that it's disconnected and then reconnecting gracefully. I see that there's a ZConn.Reconnect method but I'm not sure if that can be called in a preventative way. I guess my question is how to detect that the connection has been dropped. Thanks for any suggestions!

-Mark

Re: Reconnect or test connection question

Posted: 08.05.2021, 15:17
by aehimself
That is the exact way of doing it. I have a one-minute timer in my application which pings the endpoint, and in my main exception handler (which is assigned to Application.OnException too) I'm keeping an eye on disconnect exceptions to know when I should reconnect.

See viewtopic.php?f=50&t=138572, might be relevant to you too.

Re: Reconnect or test connection question

Posted: 08.05.2021, 17:19
by MJFShark
Awesome, thanks for the tips!

-Mark