In an app I use dbExpress and TSQLConnection to connect to a SQL Server database on a remote host.
To be able to handle possible network breaks I want to detect connection losses in the TSQLConnection-component. My app is polling the db at regular intervals and I use a try--except-construct to catch possible errors.
In a test I disconnected from the network before even starting the app.
After a long time in TSQLConnection.Connected := true I got an error like:
SQL Server Error: [DBNETLIB][ConnectionOpen (Connect()).]Either there isn't any SQL Server or access denied.
In the exception-code the app then calls a procedure ReConnectDb to keep trying to establish a connection.
Is there something like TSQLConnectionTimeOut that can speed up detection of connection loss or what can one do to handle situations like this?
The app is supposed to run at a Rescue-centre and it is a MUST to get immedate warning of problems like this