By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,482 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Programmatically test if DB server is alive?

P: n/a
In ASP VBScript, is there a way to programmatically test if a SQL Server
database server is alive?

I want to use a connection string to a mirrored DB server in case the
primary DB server fails. This failover is easy in ASP.NET, which supports DB
mirroring and a the specification of a secondary server in its data
provider. I want to hack together the same thing for my classic ASP apps.
Any suggestions?

-KF
May 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello,

To detect a Database is availeble, you may just open a connection to it and
catch possible error. For example:

Con.Open "Provider=SQLOLEDB; Data
Source=localhost;database=northwind;integrated security=SSPI"

If Err.Number <> 0 Then
...
Else
...

If there is any error after opening a connection, we can think this server
is not availeble currently and redirect to backup server.

Regards,

Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 17 '06 #2

P: n/a
Super, very helpful, thanks, Luke.

-KF
"Luke Zhang [MSFT]" <lu******@online.microsoft.com> wrote in message
news:FG**************@TK2MSFTNGXA01.phx.gbl...
Hello,

To detect a Database is availeble, you may just open a connection to it
and
catch possible error. For example:

Con.Open "Provider=SQLOLEDB; Data
Source=localhost;database=northwind;integrated security=SSPI"

If Err.Number <> 0 Then
..
Else
..

If there is any error after opening a connection, we can think this server
is not availeble currently and redirect to backup server.

Regards,

Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.