Is there an easy way to troubleshoot database connections?

Once you have set up our site as expected, you may still encounter errors. In order to troubleshoot exactly what is happening you will want to make the simplest page possible and see if you can get that to work.

The easiest way to accomplish this is to add a page to your project and create a hard coded connection.   Use this page to do a very simple select from your database.

You can also use the related link below to check your SQL Server or MySQL connection strings.  

Set CN=Server.CreateObject("ADODB.Connection")
'Place your connection string in the line below
CN.Open "DSN=Gallery"

'Check if connection opened
Response.Write "Connection Opened!

Set RS=Server.CreateObject("ADODB.Recordset")
'Place your SQL statement in the line below
RS.Open "Select * from Customers", CN, 3, 3  

'Display One Value to be sure the data has been retrieved
Response.Write "Value of first field's first record: " & RS(0)

Save the page and view it in the browser. If the Web server has the system DSN called in the script, it should complete successfully. If the page does not complete successfully, it should return a good error to troubleshoot.

Add Feedback