Quick Trick for Database Connection Strings

Setting up Database Connection Strings

Most of the times its very difficult to remember the database connection string attributes, to be specific when you are required to write a live program during an interview, its very odd to copy paste or refer Google for database connection string formats.

I have used one trick in the past found it to be very useful..just follow following quick steps:

  1. Create a text file on your desktop and rename it as test.udl.
  2. Click on it to open following window.

    Connection link

Now Just click on 'Provider' tab and select appropriate provider.

Then click Next and in 'Connection' tab,

  1. Specify source of data i.e. server name.
  2. Specify the credentials.
  3. Enter initial catalog i.e. database name.

Now click 'Test Connection' and it should succeed provided you entered right values above.

Now after closing the window, you can just open the file with a notepad to grab connection string. (reference : msdn).