troubleshooting Question

Using Delphi EX2, How can I monitor the availability of SQL server connection from my application

Avatar of HenryM2
HenryM2 asked on
Programming Languages-OtherDelphiPascal
12 Comments4 Solutions1013 ViewsLast Modified:
My application must have an on-line and an off-line mode.  I want to use a timer that call a function (attached) which checks for the connectivity of an SOL server every 15 seconds.  If the server is or becomes available for connection, the connection must be made to the SQL server, a small panel must change to green and the online mode must become active and if the server becomes unavailable the panel must turn red and the application must go in off line mode.

Problem 1
Using my attached function, when the application starts and the QSL server is not available, e.g. the user is out of the office, then the application hangs while  
      ADOConnection1.Connected := True;
tries to establish the connection, instead of just carrying on and setting the panel to Red.

Problem 2
If the server is initially available, the connection is made flawlessly.  However when the server then gets disconnected, the program remains in Online mode and the panel remains green.  Naturally then if the program executes a query, an exception is raised.

How can I do this differently to get it to work as described? Thanks

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 4 Answers and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros