Detect Database Connection and redirect if broken
Posted on 2003-11-11
I'm developing an application that connects to a local SQL Server database via IP address. The application is working fine but I would like to add a function that checks to make sure the connection is available and if the connection is not available ("SQL Server does not exist or access denied") then I'd like it to be able to redirect to a custom page to notify the visitor. Here is the connection string I'm using within an include page.
Set ConnSQL_STRING = Server.CreateObject("ADODB.Connection")
ConnSQL_STRING.open "Provider=sqloledb;Data Source=XX.XX.XX.XXX,1433;Network Library=DBMSSOCN;Initial Catalog=store2;User ID=xxxx;Password=xxxxxx;"