INF: ODBC SQL Server Connection Parameters (137635)



The information in this article applies to:

  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5

This article was previously published under Q137635

SUMMARY

This article discusses where you can find information on specifying the network parameters when you configure ODBC data sources for the Microsoft SQL Server ODBC Driver. This information applies only to the Microsoft SQL Server ODBC Driver; users of other vendors' SQL Server drivers should consult the vendors' documentation for those drivers.

MORE INFORMATION

The Microsoft SQL Server ODBC driver uses the same basic mechanism to establish connections to SQL Server as is used by applications using SQL Server's proprietary DBLIB API. Both DBLIB clients and the Microsoft SQL Server ODBC driver communicate to the underlying network through a SQL Server network library. There is a network library for each of the network protocols SQL Server can use for client/server communications. The purpose of the network library is to take generic requests from DBLIB or the ODBC driver and encapsulate those requests in the packets of the underlying network. When you configure an ODBC data source for the Microsoft driver, you must provide the driver with the same information regarding network libraries as you provide to DBLIB applications.

The connectivity parameters for SQL Server DBLIB applications are defined using the SQL Server Client Configuration Utility. The best description of the parameters that must be specified in the Client Configuration Utility is in the SQL Server version 6.0 or 6.5 "Administrator's Companion," Chapter 4, Configuring Clients. The basic information is also discussed in the SQL Server 4.21a "Configuration Guide," Chapter 3, "Client Installation and Configuration."

If you want to configure your ODBC data sources for the Microsoft SQL Server driver, you must first understand how to manage the entries in the Client Configuration Utility. You should first review the material referenced above, and then use the Client Configuration Utility to define connections and test them with the SQL Server DBLIB-based utilities, such as ISQL/w.

You need to have the SQL Server client utilities installed on your client to gain access to the Client Configuration Utility and the other utilities such as ISQL/w. It is also usually necessary to install the SQL Server client utilities if you want to use any network protocol other than named pipes to connect to SQL Server from your ODBC application. Most products which install the Microsoft SQL Server ODBC Driver only install the named pipes network library; in these cases, the only way you can get the other network libraries for SQL Server is to install the SQL Server client utilities.

Once you understand how to define SQL Server advanced network entries with the Client Configuration Utility, it is easy to configure ODBC entries for the Microsoft driver. You can configure ODBC data source names (DSNs) either by using the ODBC Administrator or calling the SQLConfigDataSource function. There is a direct correspondence between ODBC Administrator, SQLConfigDataSource, and Client Configuration Utility parameters as follows:
ODBC Administrator       SQLConfigDataSource     Client Config Utility
------------------       -------------------     ---------------------
Server                   SERVER                  Server
Network Library          NETWORK                 DLL
Network Address          ADDRESS                 Connection String
				

It is important that data sources you define for the Win32 SQL Server driver always reference a Win32 network library, and data sources for the Win16 SQL Server driver always reference Win16 network libraries:
Type    Driver     Network Libraries
-----   --------   ------------------------------------------------
Win32   SQLSRV32   DBMSSOCN, DBMSSPXN, DBMSVINN, DBMSRPCN, DBNMPNTW
Win16   SQLSRVR    DBMSSOC3, DBMSSPX3, DBMSVIN3, DBMSRPC3, DBNMP3
				

The connection information from an ODBC data source is stored in the same location and format as a Client Configuration Utility advanced client entry. After you define an ODBC DSN, its connection entry will show up as an advanced entry in the Client Configuration Utility, and DBLIB clients could use the server name to connect to SQL Server.

There are a couple of special cases regarding the parameters for ODBC data sources. If you want a data source that will always connect to a server using the current default network library defined with the Client Configuration Utility, you should specify:
   Server                <servername>
   Network Library       (default)
   Network Address       (default)
				

where <servername> is the network name of the Windows NT server running SQL Server. Any DSN set up this way should work at sites that have not installed the SQL Server Client Utilities because the ODBC driver will default to the named pipes network library, which is installed by all products that install the Microsoft driver.

If the ODBC application is on the same server as SQL Server, the following data source will connect using local named pipes:
Server               (local)
Network Library      (default)
Network Address      (default)
				

NOTE: (local) and (default) should be keyed in exactly as shown, including the parenthesis.

Modification Type:MajorLast Reviewed:10/30/2003
Keywords:kbnetwork kbother KB137635