Sunday, 26 March 2017
Task Pane 
Login
username:
password:
Remember Me
|Signup
Our Sponsors
Current Poll
SQL Server 2008
Are you ready for the upcoming SQL Server 2008 release?







[show results]
ASP page for checking database connectivity from Webserver
Author: Phillip Carter Created: Monday, 8 November 2004

This page is used to check for database connectivity between the webserver and the database server. We use it in our monitoring package to make sure the database is accessible from the webserver.

It accepts two parameters via the query string. These are the Server and database name that you want to attempt to connect to. It then opens an ADO connection to the specified database and queries the sysobjects table of that database. It doesn't return anything from the table, it just uses it in the query as follows,
SELECT 'DATABASE CONNECTION OK' as chkMsg FROM dbo.sysobjects

Example Syntax:
http://webserver/check/chkdb.asp?srvr=DBServer&dbname=DBase

If the connection is successful, this will return a page with,
DBServer - DBase


DATABASE CONNECTION OK

To use, extract the files in the zip to a directory on your webserver.
Alter database connection string in global.asa to have the appropriate username and password to connect to your SQL Server.
Create a virtual directory on IIS pointing to the directory containing the extracted files.
Open web browser and enter URL with appropriate parameters as per example above.

As always, any questions or comments are welcome.
Phill

Categories: SQL Server Stuff

User Rating of Resource 8(57 votes with a rating total of 498) | Comments Thread | Number of Downloads: 3978