Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining if SQL is running from VB 6?

Status
Not open for further replies.

svankley

MIS
Aug 25, 2000
45
US
I have a need to know, for failover support, if a SQL server is running or not. I need to check every 10-50ms to see if the server is running and if not, switch to one of 26 others. I also don't want to have to wait for the 1 minute timeout if the machine is disconnected or the network is down. I know someone along the way has had this same issue, and I'd really appreciate any guidance or suggestions with this so I don't have to reinvent the wheel.

Thanks in advance,

Steve
 
You can use SQLDMO to connect to the SQL Server and check the status, ie, running, stopped etc. I can give you some sample code if you want.

Ladyhawk. [idea]
** ASP/VB/Java Programmer **
 
Yes, I'ld like to see this sample code.

Thanks,

Steve
 
Ladyhawk,

I have been down the SQLDMO track before, and although it will tell you that it is down, using Status will take 20 seconds and produce an RPC unavailable error - if the server is not running. If the server is running, but the service is down, no problems. Everything works as expected and very fast.

(If you have had different experience please advise)

Ado gets 60 Seconds...

In the past I have used ping -n 1 server from VB and looked for the dos window to dissapear within 10 ms.. Which it usually does within 2 to 5 ms..

It seems OK, but it does have some overhead as you need to run the shell command to have it execute.

I have also played with a tcp connection and sending data, but this also seems less than optimal.


My 1c

Rob




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top