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
Reconnect or test connection question
Re: Reconnect or test connection question
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.
See viewtopic.php?f=50&t=138572, might be relevant to you too.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Reconnect or test connection question
Awesome, thanks for the tips!
-Mark
-Mark