Easiest way to test SQL Server connection

The other day I found an interesting way to test SQL Server database connection. It is very easy and quicker than what I usually do. For those of you who like moving pictures, here is a video tutorial.

To test database connection, what I usually do is to make sure port is open by using Telnet command and then use a tool like SQL Command Line, or SQL Server Management Studio,  Visual Studio Server Explorer, etc. If none of these tools is available, we can still use ODBC Data Source tool to test.  However, there is another way, a shortcut approach.

Create a new .txt file, change the file extension from .txt to .UDL, and then open the Properties of the file. In the Connection tab, you can test database from there!

7-1-2014 10-39-33 AM

Also in the Provider tab, you can select any provider for the test.

7-1-2014 11-08-30 AM

If you save the database connection in the Properties window, you can find the connection string by opening the UDL file with Notepad.

One shortage of this approach is that it seems unable to test SQL Server high availability group connection. There is not a parameter for configuring MultiSubnetFailover. I tested with an AG listener with database nodes from different subnets and it couldn’t connect.

However, it doesn’t change the fact that this is the easiest way to test SQL Server connection. Hope you find this trick useful!