INF: ODBCPING.EXE to Verify ODBC Connectivity to SQL ServerLast reviewed: April 8, 1997Article ID: Q138541 |
The information in this article applies to:
SUMMARYMicrosoft SQL Server versions 6.0 and 6.5 contain a 32-bit utility called ODBCPING.EXE that you can use to verify connectivity to MS SQL Server through Microsoft ODBC SQL Server drivers.
MORE INFORMATIONThe Odbcping.Exe utility is used to check whether ODBC and the Microsoft SQL Server driver are properly installed by connecting to a server using the ODBC SQL Server Driver. The command syntax to use the utility is: odbcping {/Sservername | /Ddatasource} /Ulogin_id /Ppassword where /U and /P are the SQL Server login ID and password, /S is the network name of the server running SQL Server, and /D is the name of an ODBC data source. Users must specify either /S or /D, but not both. The version of ODBCPING that ships with SQL Server 6.0 will only accept the /S, /U, and /P switches, it will not accept the /D parameter. Note that the switches are case sensitive. The 6.0 version of the utility is documented in the ODBC SQL Server Driver help file Drvssrvr.Hlp, which comes with SQL Server versions 6.0 and 6.5, in the section "Connecting to a Data Source." It is also in the SQL Server Books Online "Administrator's Companion," Part 6, Chapter 15, Troubleshooting and Recovery. The utility can be used against SQL Server versions 4.21a or later. ODBCPING can be used from Windows NT and Windows 95 clients. If the /D switch is used, the utility can be used against any ODBC data source for the Win32 version(s) of the Microsoft SQL Server Driver (SQLSRV32.DLL). If /D is specified for a data source using a Win32 non-SQL Server driver, ODBCPING will connect through the data source, but may encounter difficulties when it attempts to find the SQL Server version string. The utility does not work with Win16 ODBC drivers. The following example demonstrates how to use this utility and how to verify the information it provides. If you execute the following from the command line (abc is the server name):
c:\mssql\binn>odbcping -Sabc -Usa -PxyzODBCPING will return the following information on a successful connection:
CONNECTED TO SQL SERVER ODBC SQL Server Driver Version: 02.65.0201 SQL Server Version: SQL Server for Windows NT 6.50 - 6.50.201 (Intel X86) Apr 3 1996 02:55:53 Copyright (c) 1988-1996 Microsoft CorporationThe utility gives you SQL Server and driver version number information. ODBCPING was written with the assumption it would be used to test SQL Server driver data sources. If the /D switch is used to connect to a non-SQL Server driver ODBC data source, ODBCPING will print out the ODBC driver version, but will not print correct server information. If errors are encountered on the connect attempt, ODBCPING will correctly report the errors encountered. For example, issuing the following on a client that has the ODBC SDK sample applications installed:
c:\mssql\binn>odbcping -Dsdk21-Access32 -Usa -Pxyzif a successful connect, results in the following output:
CONNECTED TO SQL SERVER ODBC SQL Server Driver Version: 3.40.2505 SQL Server Version: |^wWhen the /S switch is specified, ODBCPING, will use the default network library specified in the SQL Client Configuration Utility. When the /D switch is specified, ODBCPING will use the network library defined in the data source. Users wanting to quickly test the basic setup of multiple network libraries can use the SQL Client Configuration Utility to set different network libraries as the default protocol, and test them using ODBCPING with the /S switch. For additional information regarding ODBC SQL Server Connection Parameters, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q137635 TITLE : INF: ODBC SQL Server Connection ParametersThe utility serves as an alternative to the ODBC Test utility in the ODBC SDK package. It helps in loading different network libraries and testing the connectivity through ODBC. It also helps in verifying that the ODBC modules are installed and configured correctly. The limitation, however, is that it cannot be run in a Win16 (for example, Windows 3.1 or Windows for Workgroups) client environment. There is a limitation in using the 6.0 version of the ODBCPING utility to interpret connectivity errors. For example, if the ODBCPING utility is used to try to connect to a server which does not exist in the network, then the pfNative error does not get displayed, so you cannot interpret the actual source of the problem. For more information on interpreting pfNative code reported by connectivity errors, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q137634 TITLE : INF: ODBC SQL Server Network MessagesThe scenario can be illustrated by the following example: Using the 6.0 ODBCPING utility on an unsuccessful connection with named pipes reports the following error:
C:\utils>odbcping -Sxyz -Usa -P COULD NOT CONNECT TO SQL SERVER SQLState: 01000 Error Message: [Microsoft][ODBC SQL Server Driver][dbnmpntw] ConnectionOpen (CreateFile()). SQLState: 08001 Error Message: [Microsoft][ODBC SQL Server Driver] Unable to connect to data source.While the same error in the 6.5 ODBCPING returns the following information:
C:\utils>odbcping -Sxyz -Usa -P COULD NOT CONNECT TO SQL SERVER SQLState: 01000 Native Error: 2 Error Message: [Microsoft][ODBC SQL Server Driver][dbnmpntw] ConnectionOpen (CreateFile()). SQLState: 08001 Native Error: 6 Error Message: [Microsoft][ODBC SQL Server Driver][dbnmpntw] Specified SQL Server not found. |
Additional query words: sql6 2.50 odbc windows nt err code
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |