Detecting if SQL server is running

Question :

Detecting if SQL server is running,

Answer :

I’m looking for a way to poll different servers and check that SQL server is up and running. I’m writing my code in C#. I don’t particularly care about individual databases, just that SQL server is running and responsive.

,

Well, the brute force solution is to attempt to initiate a connection with the database on each server. That will tell you whether it’s running, though you could have timeout issues.

The more elegant (but more difficult… isn’t that always the way?) solution would be to use WMI to connect to the remote machine and find out if the SQL server process is running.

Read More  Why is my asp.net application throwing ThreadAbortException?

That’s the answer Detecting if SQL server is running, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you