Easily Create and Test Connection Strings using UDL

By August 22, 2016SQL Server

Occasionally I will learn a new (or rather, new to me) trick for making a task easier and think, “Oh! How did I not know this before?” Those are usually the things I file away for a great quick tip blog, like this tip using a UDL file for a data connection test.

I was helping someone create and test connection strings on a remote VM and, unsure of what was installed on the remote machine, I needed a way for them to test a SQL database connection that didn’t require Management Studio or Visual Studio, and could be transmitted between us for comparison.

No Installation Needed

What a perfect use for a UDL file! UDL, or Universal Data Link files are perfect for creating and testing connection strings. If you have ever connected Entity Framework to a database, then the interface will look very familiar to you.

To try this yourself, just create a text file on the system you want to use the connection string from. Name it testconnection.txt, then after saving the file change the extension to testconnection.udl.

Open the file using the OLE DB Core Services, which may be your default for this file type.

2016-08-22 22_56_23-udl file - Google Search

Now you should see the connection options that can be pointed to your desired server and database.

2016-08-22 23_00_08-C__Users_Rachel_Desktop_Blogfiles_2016-08-22 22_56_23-udl file - Google Search.p

Accessing the Connection String

Once you are able to successfully connect to the database, save the file and close the editor. Now you can send or share this file with anyone else needing the connection, or you can open using a text editor and view the actual connection string to be used in your configuration files.

2016-08-22 23_02_25-C__Users_Rachel_Desktop_testconnection.udl - Sublime Text 2 (UNREGISTERED)

UDL files are far from new technology, but hey, it doesn’t have to be new to be the right tool for the job!

Want to also learn how to reconcile non-default schemas in a Visual Studio Database project? Check out my previous blog that shows you how.

The following two tabs change content below.

Latest posts by Falafel Posts (see all)