Testing for SQL2000 server availability?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how can i test in my C# code that the sql2000 server is available or can be
seen on the network? Right now when i connect to it it gives me an exception,
and it takes a while to spit out the exception, i mean i can hide the
exception message box, but the time it takes to open the connection and find
that the server is not available is just way too long.

Is there any method or something that can check the availability of an
sql2000 server on the network?
 
The easiest way is ADOX, which is a COM library. You can then check if a
server is available without having to make a connection. There may be other
ways, but this library also gives you the ability to iterate databases on
the server (if you have the right permissions) and get objects in databases
(databi for the real developer. ;-> Yes, that is a bad joke).

http://msdn.microsoft.com/library/en-us/ado270/htm/admscadoxfundamentals.asp

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
There are ProviderFactory Classes that can enumerate the providers and from
there you can enumerate the SQL Server instances that can be addressed by
those providers. From there you can use WMI classes to start, stop, pause
any service including the SQL Server instances.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
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.
__________________________________
 
Guys thanks for the help, but it seems very difficult to do something simple
in theory...

I have no clue about ADOX, and when i look up the info on it, there are a
million and one examples, but of course none of them deal with detecting if a
named instance of SQL2000 (locally / remote) is running.

I have even less clue about ProviderFactory Classes, i'm learning, and this
is no small task to do. I love C#.Net i think the entire development
environment and language/framework is awsome.

The thing is my computer is running 3 instances of SQL server, don't ask
why, i love learning how to do things.

Well the default instance is always on, and 90 percent of my data comes from
it, but i need to detect if the 2nd sql server is running, (I do not want to
start or touch it , i just want to know if it is available so that i can get
some data from it. )

Guys there has to be a simple method like "queryServerStatus(sNameOfServer);
and a return value of 0 = not active, 1 = active , 2 = Missing in action
etc...

Please for the love of god don't tell me i have to learn a book worth of
info just to check if a server is running remotely or locally.
 
Back
Top