Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: SQL Server 2000 ODBC Driver fails to return SQL Server 7.0 server names on client computers that have MDAC 2.6 installed


View products that this article applies to.

This article was previously published under Q299765

↑ Back to the top


Symptoms

From a client computer that has Microsoft Data Access Components (MDAC) 2.6 and SQL Server ODBC Driver version 2000.80.194, if you try to retrieve all of the server names by calling the SQLBrowseConnect() ODBC API function, you will not receive any SQL Server 7.0 (or earlier) server names. You will only receive the SQL Server 2000 server list.

↑ Back to the top


Cause

A bug in this version of the SQL Server ODBC driver ignores all SQL Server 7.0 names as they are returned from the SQL Server netlibs.

↑ Back to the top


Resolution

To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6 or SQL Server 2000:
290211� INF: How to Obtain the Latest SQL Server 2000 Service Pack
300635� INFO: How to Obtain the Latest MDAC 2.6 Service Pack
For customers who are unable to upgrade to the latest service pack, a supported fix is available from Microsoft, but it is only intended to correct the problem described in this article and should be applied only to systems experiencing this specific problem.

To obtain the fix, contact Microsoft Product Support Services. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, please go to the following address on the World Wide Web: NOTE: In special cases, charges that are normally incurred for support calls may be canceled, if a Microsoft Support Professional determines that a specific update will resolve your problem. Normal support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix should have the following file attributes or later:
Date         Time    Version        Size     File name     Platform
-------------------------------------------------------------------
23-MAY-2001  17:12   2000.80.298.0   28,742  Odbcbcp.dll   i386
23-MAY-2001  17:12   2000.80.298.0  471,119  Sqlsrv32.dll  i386
23-MAY-2001  17:12   2000.80.298.0   90,112  Sqlsrv32.rll  i386
				

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in SQL Server 2000 Service Pack 2 and MDAC 2.6 Service Pack 1.

↑ Back to the top


More information

To reproduce this behavior, you can either open SQL Server Query Analyzer and click the ellipsis (...) button in the Connect To SQL Server dialog box, or use the code below to test the SQLBrowseConnect() function:
#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#include <stdio.h>

#define CONNSTROUT 10000

void main()
{
HENV henv;
HDBC hdbc;
SQLRETURN sr;
SQLTCHAR szConnStrOut[CONNSTROUT];
SQLTCHAR * szConnStrIn = ( unsigned char * ) "driver={SQL Server}";
SQLSMALLINT cbConnStrOut;
int i = 1,j;
SQLTCHAR * temp = szConnStrOut;
SQLTCHAR temp2[50];

	memset( szConnStrOut, 0, sizeof( SQLTCHAR ) * STROUT );

	sr = SQLAllocHandle( SQL_HANDLE_ENV, SQL_NULL_HANDLE, & henv );

	sr = SQLSetEnvAttr( henv, SQL_ATTR_ODBC_VERSION, ( void * )
		SQL_OV_ODBC3, SQL_IS_INTEGER );

	sr = SQLAllocHandle( SQL_HANDLE_DBC, henv, & hdbc );

	sr = SQLBrowseConnect( hdbc, szConnStrIn,
		strlen( ( char * ) szConnStrIn ), 
		szConnStrOut, 
		CONNSTROUT,
		& cbConnStrOut );

	while( '{' != temp[0] )
		temp++;

	temp++;

	while( '\0' !=  temp[0] )
	{
		memset( temp2, 0, sizeof( SQLTCHAR ) * 50 );

		for( j = 0 ; temp[ j ] != ',' && temp[ j ] != '\0' ; j++ )
			temp2[ j ] = temp[ j ];

		printf( "%d\t%s\n", i++, temp2 );

		if( '\0' != temp[ j ] )
			j++;

		temp = & temp[ j ];

	}

	SQLFreeHandle( SQL_HANDLE_DBC, hdbc );

	SQLFreeHandle( SQL_HANDLE_ENV, henv );
}
				

↑ Back to the top


Keywords: KB299765, kbsqlserv2000presp2fix, kbmdac260sp1fix, kbfix, kbbug, kbqfe, kbhotfixserver

↑ Back to the top

Article Info
Article ID : 299765
Revision : 6
Created on : 9/26/2005
Published on : 9/26/2005
Exists online : False
Views : 429