INTERNET APPLICATION DEVELOPMENT
MID MARKET ERP DEVELOPMENT
by Derek Du
The other day I found an interesting way to test a 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 a database connection, I usually make sure a port is open by using the 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 are 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!
Also in the Provider tab, you can select any provider for the test.
If you save the database connection in the Properties window, you can find the connection string by opening the UDL file with Notepad.
One limitation of this approach is that it seems unable to test the SQL Server high availability group connection. There is not a parameter for configuring MultiSubnetFailover. I tested it 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 a SQL Server connection. I hope you find this trick useful!
This blog post originally appeared in Derek's blog, Stuff.