Quick Way to Troubleshoot SQL Server ADO Connections
This simple trick provides you with plenty of clues when debugging a failed SQL Server connection on a user's computer.
Troubleshooting a problem connecting to SQL Server from an end-user's computer can be a real challenge.
One quick way to check for connection problems is to open an empty Universal Data Link configuration file. Here are the step-by-step instructions:
- Open File Explorer
- Go to the View tab in the File Explorer ribbon
- Check the box next to [√] File name extensions in the Show/hide group
- Press [Alt] + [D] to highlight the address bar
- Type
%temp%
then press [Enter] to open the user's Temp folder - Go to the Home tab
- Click "New item" then choose "Text Document"
- Rename the newly created file to
Test.udl
- Click [Yes] when Windows warns you about changing the file name extension
- Double-click on the
Test.udl
file you just created
Windows will open the Data Link Properties window:
Enter the relevant information to connect to SQL Server. In the example above, I entered:
.
: a period which is a shortcut for the current computer name (I'm connecting to a development copy of SQL Server that is running locally)- (o) Use Windows NT Integrated security: select this option if you are using Active Directory Windows authentication, otherwise enter the SQL Server user name and password
- (o) Select the database on the server
NoLongerSet
: this is the name of the database on my dev server; the dropdown list will populate as long as options 1 and 2 above are valid
Finally, press [Test Connection] to make sure everything is working. If all goes according to plan, you should see the following message:
Otherwise, you will receive some sort of (hopefully) meaningful error message, such as this...
...or this...
...or this...
...or this...
Provider Tab
Sometimes the problem is that the OLE DB provider you are using to connect on your development computer does not exist on the end user's computer.
The most convenient way to check that is to jump over to the "Provider" tab. This will list all of the OLE DB providers available to the user on the current machine. If the provider you are expecting is not listed, you will need to install it for the user or switch to a different OLE DB provider.
Your Tricks
What about you? What tricks do you use to troubleshoot SQL Server connections on an end user's computer? Let us know in the comments below.