Community Pick: Many members of our community have endorsed this article.
Editor's Choice: This article has been selected by our editors as an exceptional contribution.

Get your database connection string in seconds

tphelps19IT Manager
Published:
Updated:
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
10
3,533 Views
tphelps19IT Manager

Comments (5)

CERTIFIED EXPERT

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

Good article, does this work with mysql too?

Regards.
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Administrative

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

Qlemo
Page Editor
tphelps19IT Manager

Author

Commented:
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.
CERTIFIED EXPERT
Author of the Year 2011
Top Expert 2006

Commented:
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.]
Chris LuttrellSenior Database Architect
CERTIFIED EXPERT

Commented:
Nice tip and instrustions. I'll give you a "yes" vote.

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.

Get access with a 7-day free trial.
You Belong in the World's Smartest IT Community