Microsoft KB Archive/822642

= How to configure the SQL Server Network Libraries by using SQL-DMO =

Article ID: 822642

Article Last Modified on 2/9/2004

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



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



SUMMARY
This 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.

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 libraries
Warning 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 = &quot;SQL-DMO Explorer&quot; oSQLServer.Connect &quot;&quot;, &quot;&quot;, &quot;&quot; '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 = &quot;np tcp&quot; oSQLServer.Close Set oSQLServer = Nothing Set reg = Nothing Note Replace  with your SQL Server name, replace   with your user name, and replace   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. </li> Run the Visual Basic application.</li></ol>

How to disable the server network libraries
Warning 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: <ol> 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.</li> On the Project menu, click References.</li> In the Available References box, click to select Microsoft SQL DMO Object Library, and then click OK.</li> On the View menu, click Code.</li>  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 = &quot;SQL-DMO Explorer&quot; oSQLServer.Connect &quot;<Server Name>&quot;, &quot;<User Name>&quot;, &quot;<Password>&quot; '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 = &quot; &quot; oSQLServer.Close Set oSQLServer = Nothing Set reg = Nothing Note Replace  with your SQL Server name, replace   with your user name, and replace   with your password. </li> 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.</li></ol>

How to verify the SQL Server network libraries settings
To verify what SQL Server network libraries are enabled, follow these steps:
 * 1) Click Start, point to Programs, and then point to Microsoft SQL Server.
 * 2) Click SQL Server Network Libraries.
 * 3) 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.

<div class="references_section">