How to determine a running SQL Server

  • Thread starter Thread starter Michael Schneider
  • Start date Start date
M

Michael Schneider

Hi!

I am writing a database application in C#. So I want to know if the server
is running. At this moment it takes a long time till i get an answer
(exception). How can i proof it fast?

Thanks,
Michael
 
You can use Sql-Dmo or a method like this
http://www.codeproject.com/cs/database/LocatingSql.asp ....another (albeit
much uglier and potentially problematic) approach is to drastically shorten
the timeout on your connection via the connect string..but this really isn't
a solution and would merely minimize the symptoms you are describing.

HTH,

Bill
 
The problem is, that the timeout clock does not start until the network
wakes up and the server answers. It's not a "network" timeout, it's more
like a "Once you've found the server, don't wait any longer than "N" seconds
for a connection to become available".

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Bill:

Wow, I see your point but didn't realize that's when the timeout started.
So in this case, if you bumped the Timeout to 1 second and the server was
down, it'd take x seconds before you were aware of that if I understand
correctly. I had written a ServerExists function previously using the API
Calls in the first method I suggested and if the names returned weren't in
the .config file, I assumed the server wasn't available The server names
seldom change and the app only runs in one location so it seemed a fair way
to do it. What do you think, is this an ok way of doing it or is there a
more solid way to get there?

Thanks again,

Bill
 
Right (and why aren't you watching the game?)
The NIC timeout is 45-90 seconds (or so) which means if the NIC is down, the
cable is disconnected, the wireless is not connected, the hub is dead, the
router is pooched or.... it takes a lot longer to get back from the
Open--regardless of the Timeout setting.
I've heard of using the Ping approach, but it too can take some time, but I
like the API techniques.
Frankly, there should be better support for this in the data access
layers--we've been asking for it for a decade to no avail. Perhaps in
Whidbey (but not likely at this late date).

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
This definitely explains a lot. Many thanks!
William (Bill) Vaughn said:
Right (and why aren't you watching the game?)
The NIC timeout is 45-90 seconds (or so) which means if the NIC is down, the
cable is disconnected, the wireless is not connected, the hub is dead, the
router is pooched or.... it takes a lot longer to get back from the
Open--regardless of the Timeout setting.
I've heard of using the Ping approach, but it too can take some time, but I
like the API techniques.
Frankly, there should be better support for this in the data access
layers--we've been asking for it for a decade to no avail. Perhaps in
Whidbey (but not likely at this late date).

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top