Home / ASP.NET Wiki / Data Access / Connection String

Connection String

 Rate It (0)

The connection string specifies information about how to initialize a connection to a data store.

It contains keyword/value pairs. the first pair is always the Provider or Driver. The following pairs will correspond with the data required to initialize the provide / driver.

Some Example Keywords:

SQL ODBC: Server, Database, Uid (user), Pwd (password), Trusted_Connection, MARS_Connection (multiple active record sets), Encrypt, AttachDbFilename,

SQLOLEDB: Data Source, Initial Catalog (database to connect to), UserId, Password, Integrated Security, Failover Partner (for mirroring).

Some example connection strings:

SqlConnection (.NET) standard Security:

"Data Source=ServerAddress;Initial Catalog=DataBase;User Id=username;Password=password;"

ODBC - PostgreSQL driver:

"Driver={PostgreSQL};Server=IP address;Port=5432;Database=DataBase;Uid=username;Pwd=password;"

More example connection string:
http://www.connectionstrings.com/

Revision number 4, Tuesday, May 05, 2009 9:50:27 PM by rtpHarry

Comments

It is great resource for my junior team members, i like to share it with them. Nice job.

very good

Another good prcatice would be to encrypt the connection string when you go live with the website

Nice Job.

great

Good! It can be help out to the new developers.

Good reference listing!

its nice one.

Always define connection string inside the Web.Config file.

http://www.connectionstrings.com/ is really great site. you point the database it will give you connection string

Related Articles

To Connecting the Database to Gridview Using Ado.net example

In Aspx.cs page------------------------------string connectionString = ConfigurationManager.ConnectionStrings["DropDownListConnectionString"].ConnectionString; protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection

Encrypt & Decrypt ConnectionString Section

Encrypt & Decrypt ConnectionString Section Sometimes we need to secure ConnectionString to prevent anyone can knows it. whatever your purpose from securing ConnectionString, there is a way to Encrypt and Decrypt ConnectionString by special codes as we

Upload an Image and an Audio file using C#

In my case, I use a FileUpload Control(Id:->FileUpload1), an ImageButton(ImageButton1) or you can use the Image, a Button Control(Id:->Updatebttn) to upload my Image, Button Control(Id:->Addbttn) to add my Image in database, an image(which I want

accessdatasource

The AccessDataSource class is a data source control that works with Microsoft Access databases. Like its base class, SqlDataSource, the AccessDataSource control uses SQL queries to perform data retrieval. One of the unique characteristics of the AccessDataSource

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. abiruban (1)