Connection Strings for All Databases

Introduction

Databases are widely used in applications to keep records. A large variaty of Database Management Systems are available in the market and in use. Every DBMS needs a different format of connection string. It's not possible to remember all those formats, so knowing how to get a Connection String for any database makes life easy.

UDL file Method

UDL Files are an easy way to get the desired connection string by simply filling in property pages. The following steps show how to make and use a UDL file for that.

1. Make a New Text Document

1.jpg

2. Open the Text Document, Click on Save As.

2.jpg

3. Write filename as something.udl, file type All files, click Save.

4. Now run something.udl

5. Click on Provider tab. Select the provider and click Next.

database connection string - dontumindit (1).jpg


6. Give the DataBase Path.

database connection string - dontumindit (2).jpg

7. Write Username, Password if any

database connection string - dontumindit (3).jpg


7. Click on Test Connection.

database connection string - dontumindit (4).jpg


8. If it's OK, then close it now.

9. Now open udl file as Text File with Notepad

database connection string - dontumindit (5).jpg

11. The Last line will have the Connection String

database connection string - dontumindit (6).jpg

Visual Studio DataSource Method

1. Add DatagridView to your Form.

2. Click on Arrow in Top Right Corner of DataGridView, Click Choose DataSource, Select Add New DataSource

database connection string - dontumindit (7).jpg

3. Select Database, Click on Next.

database connection string - dontumindit (8).jpg


4. Click on New Connection

database connection string - dontumindit (9).jpg


5. Now Choose DataSource, Click on Continue

database connection string - dontumindit (10).jpg

6. Browse For Database, Provide Username, Password, if any

database connection string - dontumindit (11).jpg

7. Click On Test Connection

database connection string - dontumindit (12).jpg
8. If all is Ok, Click Previous, Copy the Connection String, and Click Cancel, Delete DataGridView if you don't need it.

database connection string - dontumindit (13).jpg


Oracle Connection String

Following is the Correct Format of Oracle Database Connection

 private static string CONNECTION_STRING =
"User Id=myUserID;Password=myPassword;Data Source=(DESCRIPTION=" +
"(ADDRESS=(PROTOCOL=TCP)(HOST=myserver.server.com)(PORT=yourPort#))" +
"(CONNECT_DATA=(SID=yourSID)));"


(For Detailed Study of Connection Strings)

Online Connection strings


SQL Connection Strings


Do suggest/Comment, Help Others

Up Next
    Ebook Download
    View all
    Learn
    View all