Essential Developer Tools - Part 3: UDL Files

Submitted by Robert MacLean on Wed, 12/19/2007 - 14:03
One thing about being a developer is that at some point you will have to work with databases/datastores. It's a fact of life (like death and taxes). The thing about these databases is that they all have connections strings to get to them, but the problem is how do you get the connection string? A popular website is which lists them and you can then copy, paste and modify those for your own needs.

However there is a problem with this, in that it's open to errors during the modification (assuming you can copy and paste without error) and that there is no nice test system for your environment. Well fear not, Windows (I've known about this since Windows 2000 and can confirm it works on XP, Vista and 2003 fine) has a great feature for finding out connection strings, and testing them.

To do this you create a new empty file somewhere (desktop is good, cause you can go right click New -> Text Document). The trick is to make sure the file extension is udl (i.e. connection.udl). Now you can double click this file and using the (possibly) familiar connection wizard/odbc thing to set and test the values the values:
Once you click OK the window disappears.

So what good is that? Well if you now open that file in notepad you'll find the connection string in plain text right there! With all the right values for your environment! Anyway happy connecting!

Update 10 Jan 2008: If you are doing this on x64 machines and getting issues this may help: