Test SQL Connection without SSMS

Test SQL Connection without SSMS

Background

You’ll find yourself logged into a web or application server and need to test that you can access the SQL server at which you’ve unsuccessfully tried to point your app. Luckily, a trick built into Windows allows you to save the day without having to install anything on your box – and it works on both client and server operating systems just as well.

The mythical UDL file

The guys at Microsoft have baked a SQL Connectivity tool right into Windows by creating Microsoft Universal Data Link files (*.UDL) – something designed for another purpose.

These were designed to save SQL connection data for use in a whole range of applications and are available on almost every version of Windows.

They also provide a great way to test SQL Connectivity.

Create a UDL file

Create a new file anywhere. For example, create a new Text file on your desktop

image-84 Test SQL Connection without SSMS

Rename that file and change its file extension to TestDatabase.udl (take note of the file extension).

image-83 Test SQL Connection without SSMS

Select “Yes” when asked to change the file extension.

This will give you a Data Link Editor to test the connection.

image-83 Test SQL Connection without SSMS

I have used this countless times. Typically, my applications run under Dot Net and Dot Net Core. These are another layer between your applications and SQL. Using UDL files is a clean, direct way to ensure the server can access the SQL database. If UDL can access it, the problem is with your application or Dot Net. If it can’t, then you have a direction to go in that doesn’t include your application.

Stephen

Hi, my name is Stephen Finchett. I have been a software engineer for over 30 years and worked on complex, business critical, multi-user systems for all of my career. For the last 15 years, I have been concentrating on web based solutions using the Microsoft Stack including ASP.Net, C#, TypeScript, SQL Server and running everything at scale within Kubernetes.