Testing a SQL database connection

“Error: Cannot connect to database server X”

How many times have you seen this error? You can ping the database server, and are *certain* the connection works. Here’s a way to verify:

Login to the web server as the user that needs to connect to the database.

1) Open notepad and save a blank text file as “connection.udl” to your desktop.
2) Right-click on connection.udl, and choose “Open” from the menu. This will open the a “Data Link Properties” window.
3) Choose the “Provider” tab, and ensure that “Microsoft OLE DB provider for Sql Server” is selected (if you are connecting to SQL Server.)
4) Click on the “Connection” tab.
5) In the “Select or enter a server name:” field , enter the name of your database server.
6) Ensure “Use Windows NT Integrated security” is selected.
7) Click the drop-down box below the “Select a database on this server” section.

If your credentials are working, this drop-down list will now be populated with a list of databases your credentials can access. This is the first indication you have proper access. To be certain, click the “Test Connection” button and fully validate the connection.
properties

connection_success