Systems Engineering and RDBMS

Different connection strings – SQL Server

Posted by decipherinfosys on April 30, 2009

While working on different client applications, we have seen different types of connection strings in order to make the connection to the back-end RDBMS.  In this post, we will cover some of the common ones for SQL Server.  In the upcoming posts, we will do the same for Oracle and DB2 LUW.  We have covered some of them before, so let’s recap those before we proceed further:

1) How to create a UDL (Universal Data Link) – this post describes the creation and testing of a UDL and then saving the connection string.

2) Specifying a port number in the connection string – here.

3) Using a server alias for making the connection – here.

Now, here are some more connection strings:

4) SQL Server Authentication:

Provider=SQLOLEDB.1;Password=sixthSense;Persist Security Info=True;User ID=appuser;Initial Catalog=BizTalkMsgBoxDb;Data Source=qadb-01

The userID and password are passed in since this is SQL Server Authentication mode.

5) Windows Account Authentication:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BizTalkMsgBoxDb;Data Source=qadb-01

There is no UserID and Password in this case and it relies on the Windows Authentication.

6) Connecting to a named instance:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BizTalkMsgBoxDb;Data Source=qadb-01\QCTEST

QCTEST is the named instance in this case which is mentioned in the Data Source parameter of the connection string using a “\”.

7) Connecting by using an IP Address and specifying a specific network library to use (you can also just use an alias for doing this – see #3 above).

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BizTalkMsgBoxDb;Network Library=DBMSSOCN;Data Source=,1433

DBMSSOCN specifies TCP/IP.  You can get more information on this parameter (Network Library) from here.

8 ) Setting MARS (Mutliple Active Result Sets) to true in the connection string:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BizTalkMsgBoxDb;MultipleActiveResultSets=true;Data Source=qadb-01

If you are using the MARS functionality (introduced in SQL Server 2005), then you will need to use the parameter shown above.

And by picking up different kind of ODBC Drivers or SQL Native Client instead of the OLEDB provider, you will get different variations of these connection strings, Examples:

Using SQL Native Client:

Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BizTalkMsgBoxDb;Data Source=qadb-01

Using OLEDB Provider for ODBC Driver:

Provider=MSDASQL.1;Persist Security Info=False;User ID=appuser;Password=sixthSense;Data Source=test;Initial Catalog=BizTalkMsgBoxDb

Using SQLXML OLEDB Provider:

Provider=SQLXMLOLEDB.4.0;Data Provider=SQLNCLI.1;Integrated Security=SSPI;Initial Catalog=BizTalkMsgBoxDb;Data Source=qadb-01

Note: There are some other parameters also in the connection strings that you can play around with.  You can read more on those here.


  • The links given above in the post.
  • All the connection string references for RDBMS, Data Files, OLAP and others – here.
About these ads

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 74 other followers

%d bloggers like this: