THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

John Paul Cook

Building connection files by using a UDL file

Oops, that should be connection STRINGS in the title instead of files. I can’t fix the typo in the title because it would break links to this post. A UDL file brings up the Data Link Properties dialog box for testing a connection or building a connection string for you. It’s very handy.


All you need to do is create a UDL file. It’s so useful I have a UDL file on the desktop of all of my machines.

Start by creating a text file on your desktop or wherever you want.


Select the entire file name including the txt file type (this means that your machine must be configured to show the extension) and change the name and file type to test.udl or connection.udl or whatever you prefer.

Now you have a UDL file on your desktop:


Double-click the UDL file to bring up the dialog box. By default it appears as shown above. It isn’t limited to just SQL Server connection strings. It works for all of your OLE DB data providers as you can see on the provider tab. Notice that in the screen capture below, Oracle’s provider appears.


It gets even better! Once you’ve successfully tested your connection, click OK to save your connection string into the UDL file. Open the UDL file in a text editor and you’ll find your fully constructed connection string. For example:

; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=cookjp;Initial Catalog=SomeOtherDb;Data Source=SRV2

In this example, SQL Server authentication was used. Notice that for security purposes, the password was not persisted into the UDL file. If you check Allow saving password on the Connection tab of the Data Link Properties dialog box, it will save the password into the connection string in the UDL file after displaying this warning:


You can drag your UDL file to a Visual Studio project to get the connection string:


Published Monday, July 19, 2010 11:32 AM by John Paul Cook



WesBrown said:

Built a little utility a million years ago in that I could call and generate a UDL on the fly in my DTS packages. Fun stuff!

July 19, 2010 1:15 PM

Sudarshan.D said:


In my computer udl file not create. i had many times did it. but not create udl file. kindly give me a solution to create the udl file

thanking you


December 27, 2013 1:39 PM
Anonymous comments are disabled

About John Paul Cook

John Paul Cook is a database and Azure specialist in Houston. He previously worked as a Data Platform Solution Architect in Microsoft's Houston office. Prior to joining Microsoft, he was a SQL Server MVP. He is experienced in SQL Server and Oracle database application design, development, and implementation. He has spoken at many conferences including Microsoft TechEd and the SQL PASS Summit. He has worked in oil and gas, financial, manufacturing, and healthcare industries. John is also a registered nurse recently completed the education to become a psychiatric nurse practitioner. Contributing author to SQL Server MVP Deep Dives and SQL Server MVP Deep Dives Volume 2. Connect on LinkedIn

This Blog



Privacy Statement