Get your database connection string in seconds

Published on
13,774 Points
10 Endorsements
Last Modified:
Have you ever wanted a quick way to get the connection string for your database?  I use this all the time whenever I am doing web development or Access programming and need to get any connection string in a jiffy.

1)  Create a new text document on your desktop and just call it "test.txt".

2)  Rename the document and change the extension to "test.udl".

3)  It will ask you if you are sure you want to change the extension, just click "OK".

4)  Double click on the newly renamed file and it will open up a window for "Data Link Properties" and in here you can easily enter all the information needed to access your database.

5)  Click the "Provider" tab on the upper left and select from the list of providers what kind of database you want to connect to.  
Selecting Your Database Type (Provider)NOTE:  If the type of database you want to connect to is not listed then the computer you are on does not have the driver for that database installed.  This is also a great troubleshooting step that you can detect early if you can't connect using a pre-existing connection string.

6)  Then click the "Connection" tab and enter the server name or IP address of the server it resides on.  The layout of this tab varies based upon the database provider you choose but the basics are the same.  
Entering Database Properties & Credentials7)  Enter any credentials needed to access the database and check the box for "Allow password saving" if you want the connection string to contain the password.

8)  Click the "Test Connection" button to make sure you've entered everything correctly and if it does not come back successful then you need to recheck your entries and try again.
Connection String Test Successful9)  Click "OK" to close the window and get back to your original file.  Right click and select "Rename" and change the file extension back to "test.txt".

NOTE:  If you selected "Save password" then you will get a prompt asking if you are sure because it will be stored as plain text, just click "Yes".

10)  Open the newly renamed "test.txt" file and voilà!  Your full connection string is the last line in the file.  You can simply copy/paste into any application you are working in.

Enjoy.   :-)
Finished Connection String in Notepad
LVL 12

Expert Comment

>> violá!
it's voila actually :)

Good article, does this work with mysql too?


Administrative Comment

In fact, it is voilà, because it is french. I've corrected that.

Page Editor

Author Comment

Hey as long as you vote for my article it can be whatever you want.  :-)

And yes this does work for mySQL too as long as you have the driver for it.
LVL 38

Expert Comment

A nice functional set of instructions.
"Yes" vote above.

[BTW "Viola" (not voila) was a favorite expression of "Alfalfa" in the Little Rascals series. He wasn't too smart, but he sure could sing.]
LVL 27

Expert Comment

by:Chris Luttrell
Nice tip and instrustions. I'll give you a "yes" vote.

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Join & Write a Comment

In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month