Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1433
  • Last Modified:

Is there a timeout property for TSQLConnection.Connected := true?

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

Regards
Staffan
0
staffanbergbom
Asked:
staffanbergbom
  • 2
1 Solution
 
mikelittlewoodCommented:
If I remember right it used to be 30 seconds.
0
 
staffanbergbomAuthor Commented:
But is there something you can do about to reduce that amount of time?
0
 
mikelittlewoodCommented:
Well TADOConnection has a connectionTimeout property, dont know about TSQLConnection sorry :o(
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now