Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between these connection strings?

Can anybody tell me the effective difference between the following connection strings:

<add key="ConnectionString" value="server=tcp:192.168.0.12\Sqlserver2005;database=;user id=sa;password=;">



<add key="ConnectionString" value="server=192.168.0.12\Sqlserver2005;database=;user id=sa;password=;Network Library=DBMSSOCN;">

I believe both are effectively the same. Specifying "Network Library=DBMSSOCN" explicitly connects using TCPIP and prefixing server value with TCP does the same thing.

Please tell me if there is any difference or any performance implication of specifying these settings in web.config.

like image 640
Rohit Raghuvansi Avatar asked Oct 07 '09 10:10

Rohit Raghuvansi


People also ask

What is difference between AppSettings and connection strings?

The main difference is in appsettings section we can store any data string values including database connection strings also but in connectionStrings section only database connection strings can store those are our application connection strings and new features (Membership, Personalization and Role Manager) connection ...

What are the different parts of a connection string?

The Connection String includes parameters such as the name of the driver, Server name and Database name , as well as security information such as user name and password.

How do you define a connection string?

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.

What is a connection string in database?

A connection string is a string that contains information about a data source (usually a database engine), as well as the information necessary to connect to it.


1 Answers

The difference between the two options is:

Specifying the protocol

By using either,

Multiprotocol = rpc

Shared Memory = lpc

NWlink IPX / SPX = spx

Banyan VINES = vines

Apple Talk = adsp

TCP = tcp

This is the recommended way. I also feel its safer as DLL names are likelier to change than protocol names.

It also allows you to change the port number, rather than configuring it across the board by using the SQL Server Client Network Utility.

Specyfying the Library without the dll extension

Specifying the library will use the same name as the actual network DLL library file without the .dll extension.

Example:

TCP/IP: C:\WINDOWS\system32\DBMSSOCN.dll

Named Pipes: C:\WINDOWS\system32\DBNMPNTW.dll

Multiprotocol (RPC): C:\WINDOWS\system32\DBMSRPCN.dll

NWLink IPX/SPX: C:\WINDOWS\system32\DBMSSPXN.dll

AppleTalk: C:\WINDOWS\system32\DBMSADSN.dll

Banyan VINES: C:\WINDOWS\system32\DBMSVINN.dll

This will work best when you want to write your own network library. Please see SQL Server Client Network Utility.

The performance trade-off is minute and not noticeable. It is best to stick to standards and have it configured in the web.config as other developers will know where to look for the connections settings. Similar to having a data-source connection in java.

like image 197
Koekiebox Avatar answered Oct 27 '22 13:10

Koekiebox