How to configure the SQL Server Network Libraries by using SQL-DMO (822642)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
Important This article contains information about modifying the registry.
Before you modify the registry, make sure to back it up and make sure that you
understand how to restore the registry if a problem occurs. For information
about how to back up, restore, and edit the registry, click the following
article number to view the article in the Microsoft Knowledge Base: 256986 Description of the Microsoft Windows Registry SUMMARYThis article describes how to programmatically enable or disable the SQL Server network
libraries for an instance of Microsoft SQL Server 2000 by using SQL Distributed
Management Objects (SQL-DMO).MORE INFORMATION SQL Server 2000 uses the server network libraries to shield
the database engine from the details of communication with different
Interprocess Communication (IPC) components by extending the server network
libraries support to different protocols. SQL Server installs a network library
on the client and on the server for each protocol. The client application and
SQL Server use these network libraries to communicate with each
other. Here is a list of the server network libraries that are
available for SQL Server 2000.
- Named Pipes
- TCP/IP
- Multiprotocol
- NWLink IPX/SPX
- AppleTalk
- Banyan Vines
- VIA(Giganet and QLogic)
- Shared Memory Net-Library
Generally, you use the Server Network utility that is
provided with SQL Server 2000 to configure the server network libraries.
However, you may have to configure the server network libraries
programmatically for some SQL Server applications. You can programmatically
configure the server network libraries by using the Registry2 object of the SQL
Distributed Management Objects (SQL-DMO) API. When you use the Registry2 object
of the SQL-DMO API, you must set the SuperSocketList property of the Registry2 object to the super socket protocol
list that is represented by the SQL-DMO multi-string. The following table lists the super socket protocols that correspond to
each server network library. The table also
lists the string value that corresponds to each super socket protocol. The
string value is what you must use when you set the SuperSocketList property of the Registry2 object. Super Socket Protocol | String value | Named Pipes | np | TCP/IP | tcp | Multiprotocol | rpc | IPX/SPX | spx | AppleTalk | adsp | Banyan Vines | bv | VIA | via | Note SQL Server uses these network libraries to
communicate with the client applications that exist on other computers.
SQL Server uses the Shared Memory network library to communicate with
the applications that are on the same computer as the instance of SQL Server
2000. The Shared Memory network library is always enabled and does not have to
be configured. How to enable the server network librariesWarning If you use Registry Editor incorrectly, you may cause serious
problems that may require you to reinstall your operating system. Microsoft
cannot guarantee that you can solve problems that result from using Registry
Editor incorrectly. Use Registry Editor at your own
risk. Note The following code example sets the Named Pipes (np) and the
TCP/IP (tcp) network libraries for SQL Server. You can replace the server
network libraries that are in the code example with the server network
libraries that you want. To enable the server network libraries,
follow these steps: - Start Microsoft Visual Basic 6.0, and create a new Standard EXE project.
Note By default, a form that is named Form1 is
created. - On the Project menu, click
References.
- In the Available References box,
click to select Microsoft SQL DMO Object Library, and then
click OK.
- On the View menu, click
Code.
- In the Form_Load event for Form1, paste the following code.
Dim oSQLServer As SQLDMO.SQLServer
Dim reg As SQLDMO.Registry2
Set oSQLServer = New SQLDMO.SQLServer
oSQLServer.LoginTimeout = 10
oSQLServer.ODBCPrefix = False
'Connect to SQL Server
oSQLServer.ApplicationName = "SQL-DMO Explorer"
oSQLServer.Connect "<Server Name>", "<User Name>", "<Password>"
'Initialize the Registry2 object to the registry settings corresponding to the instance of SQL Server
Set reg = oSQLServer.Registry
'Set the SuperSocketList property
reg.SuperSocketList = "np tcp"
oSQLServer.Close
Set oSQLServer = Nothing
Set reg = Nothing
Note Replace Server Name with your SQL
Server name, replace User Name with your user name,
and replace Password with your password.
In this code example, the SuperSocketList property is set to a string value that contains the specific
values that correspond to the appropriate network library. If there are
multiple string values, each string value must be separated by a space. You can
replace the string value with the appropriate combination of string values that
correspond to the network libraries. - Run the Visual Basic application.
How to disable the server network librariesWarning If you use Registry Editor incorrectly, you may cause serious
problems that may require you to reinstall your operating system. Microsoft
cannot guarantee that you can solve problems that result from using Registry
Editor incorrectly. Use Registry Editor at your own
risk. To disable all the server network libraries, set
the SuperSocketList property to an empty string. To do so, follow these steps:
- Start the Microsoft Visual Basic 6.0, and create a new Standard EXE project.
Note By default, a form that is named Form1 is
created. - On the Project menu, click
References.
- In the Available References box,
click to select Microsoft SQL DMO Object Library, and then
click OK.
- On the View menu, click
Code.
- In the Form_Load event for Form1, paste the following code:
Dim oSQLServer As SQLDMO.SQLServer
Dim reg As SQLDMO.Registry2
Set oSQLServer = New SQLDMO.SQLServer
oSQLServer.LoginTimeout = 10
oSQLServer.ODBCPrefix = False
'Connect to SQL Server
oSQLServer.ApplicationName = "SQL-DMO Explorer"
oSQLServer.Connect "<Server Name>", "<User Name>", "<Password>"
'Initialize the Registry2 object to the registry settings corresponding to the instance of SQL Server
Set reg = oSQLServer.Registry
'Set the SuperSocketList property
reg.SuperSocketList = " "
oSQLServer.Close
Set oSQLServer = Nothing
Set reg = Nothing
Note Replace Server Name with your SQL
Server name, replace User Name with your user name,
and replace Password with your password. - Run the Visual Basic application.
Note If you run the code that is provided in the example, all the
server network libraries that are on the computer that runs SQL Server may be
disabled. If you try to connect to your instance of SQL Server, you may
experience connectivity issues until you enable the appropriate server network
libraries either manually or programmatically. Make sure that you run the code
that is provided in the example only when you are sure that you want to disable all
the server network libraries that are on the computer that is running SQL
Server.
How to verify the SQL Server network libraries settingsTo verify what SQL Server network libraries are enabled, follow
these steps:
- Click Start, point to
Programs, and then point to Microsoft SQL
Server.
- Click SQL Server Network
Libraries.
- On the General tab, verify the network libraries that are in the Enabled protocols list box. To do so, match the name of the network libraries that
were enabled by using code to the list of the network libraries that you see in
the Enabled Protocols list box.
REFERENCESFor more information about how to connect to an instance of
SQL Server, visit the following Microsoft Web site: For additional information about the Registry2 object, visit the following Microsoft Web
sites:
Modification Type: | Major | Last Reviewed: | 2/9/2004 |
---|
Keywords: | kbRegistry kbServer kbenable kbConfig kbinfo kbcode KB822642 kbAudDeveloper |
---|
|