In computing, a connection
string is a
string that specifies information about a data source and the means of connecting to it. It is passed in code to an underlying driver or provider in order to initiate the connection. Whilst commonly used for a database connection, the data source could also be a spreadsheet or text file.
The connection
string may include attributes such as the name of the driver, server and database, as well as security information such as user name and password.(source
wikipedia[
^] )
UDL file can be used to generate connection
strings easily.
How to make
UDL file?
- Make a text file, open it.
- Click on Save As.
- Write filename as something.udl, file type All files, click Save.
- Now run something.udl.
- Click on Provider tab. Select the provider and click Next.
- Give the DataBase Path, Give Username, Password, if any.
- Click on Test Connection.
If it's OK, then close it now.
Now open udl file as text file, connection
string will be there in the last line.
Following is the connection
string format for Oracle:
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)));"
An alternate of doing it is as follows:
- Add
DataGridView in your Form.
- Provide
DataSource by Browsing, do the Settings, once all done, don't click OK, go back to first step by clicking Previous.
- Click on Show Connection String.
- Copy it, and use where you want.
For more details with screenshots, see MY Article
Connection Strings[
^].
Following are the links to websites which provide Connection Strings Format for various DBMS: