How To Set the SQL Server Network Library in an ADO Connection String

How To Set the SQL Server Network Library in an ADO Connection StringView products that this article applies to.
Article ID:238949Last Review:July 15, 2004Revision:3.3
This article was previously published under Q238949
SUMMARYSQL Server allows you to choose from a number of different network libraries that you can use when connecting. You can configure these network libraries when you create a data source name (DSN) for your data source. However, an alternative way to specify the DSN is to pass in the network library, which you want to use, with the connection string. This article describes how to specify the network library that you want to use for connecting to SQL Server when connecting from a Visual Basic application that uses ActiveX Data Objects (ADO). Back to the top
MORE INFORMATIONSQL Server allows you to use the following network libraries when establishing a connection. They are:
?dbnmpntw - Win32 Named Pipes?dbmssocn - Win32 Winsock TCP/IP?dbmsspxn - Win32 SPX/IPX?dbmsvinn - Win32 Banyan Vines?dbmsrpcn - Win32 Multi-Protocol (Windows RPC)When connecting to SQL Server through ADO the NETWORK parameter in the connection string can be used to specify which of these libraries to use when connecting to the database. The NETWORK parameter is the name of the Net-Library module to use, without the .dll suffix (for example, Dbmssocn, not Dbmssocn.dll). Here are some examples of connection strings that specify this parameter:

Note Make sure that User ID has the appropriate permissions to perform this operation on the database. ?The following connection string:

"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=<User ID>;Initial Catalog=pubs;Data Source=<YourDataSourceName>;Network Library=dbnmpntw"

tries to connect to SQL Server through the SQLOLEDB provider using the Named Pipes network library.?The following connection string:

"Provider=MSDASQL.1;Persist Security Info=False;User ID=<User ID>;Extended Properties="DSN=<yourdatasourcename>;UID=<User ID>;DATABASE=pubs;Network Library=dbmssocn";Initial Catalog=pubs"

connects to SQL Server through the MSDASQL provider using the TCP/IP network library.Back to the top
REFERENCESFor additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base: 137635 (http://support.microsoft.com/kb/137635/) INF: ODBC SQL Server Connection Parameters
137634 (http://support.microsoft.com/kb/137634/) INF: Reading ODBC SQL Server Driver Network Messages
Back to the top
APPLIES TO?Microsoft Data Access Components 1.5?Microsoft Data Access Components 2.0?Microsoft Data Access Components 2.1?Microsoft Data Access Components 2.1 Service Pack 2?Microsoft Data Access Components 2.1 Service Pack 1?Microsoft Data Access Components 2.1 Service Pack 2?Microsoft Data Access Components 2.5?Microsoft Data Access Components 2.6?Microsoft Data Access Components 2.7

加支付宝好友偷能量挖...


评论(0)网络
阅读(120)喜欢(0)SQL及数据库