Microsoft KB Archive/883714

= FIX: You may receive a &quot;Cannot generate SSPI context&quot; error message when you try to connect to an instance of SQL Server 2000 SP3 =

PSS ID Number: 883714

Article Last Modified on 8/25/2004

-

The information in this article applies to:


 * Microsoft Data Access Components 2.8, when used with:
 * the operating system: Microsoft Windows XP

-





SYMPTOMS
You may not be able to connect to an instance of Microsoft SQL Server 2000 Service Pack 3 (SP3) from a client computer if the server name cannot be resolved from the IP address of the computer that is running SQL Server 2000 SP3.

When you connect to the instance of SQL Server by using SQL Query Analyzer, you receive the following error message:

Server: Msg 11004, Level 16, State 1

[Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context

When you use the Microsoft SQL Server OLE DB provider (SQLOLEDB) to connect to the instance of SQL Server, you receive the following error message:

Source: &quot;Microsoft OLE DB Provider for SQL Server&quot;

Interface: IID_IDBInitialize

Result: 0x80004005 = E_FAIL

ISQLErrorInfo: [HY000][0x00002afc]

IErrorInfo: [0x00002afc]&quot;Cannot generate SSPI context&quot;

File: D:\MDACTools\rowsetviewer\CBase.cpp

Line: 1067

You may also notice this problem when you try to connect to a virtual instance of SQL Server 2000 that is installed on a cluster node by using the virtual IP address of the SQL Server cluster.



CAUSE
Microsoft SQL Server ODBC Driver (SQLODBC) and SQLOLEDB both call the ConnectionGetSvrUser function of the dbnetlib library to connect to a server computer that is running SQL Server. The ConnectionGetSvrUser function is designed to return a void. However, SQLOLEDB and SQLODBC incorrectly assume that this function returns a Boolean value. Therefore, SQLOLEDB and SQLODBC read the contents of the EAX register as the return value from the ConnectionGetSvrUser function.

The ConnectionGetSvrUser function internally calls the gethostbyaddr function. The gethostbyaddr function obtains the host name that corresponds to a particular IP address. If the gethostbyaddr function fails, it sets the value of the EAX register to zero. SQLOLEDB and SQLODBC pick up this value as the return value from the ConnectionGetSvrUser function. Because the zero value corresponds to the Boolean FALSE value, the connection attempt to the instance of SQL Server fails.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft Windows XP. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

322389 How to obtain the latest Windows XP service pack

To resolve this problem, you can also obtain the hotfix that is mentioned in the following Microsoft Knowledge Base article:

843248 FIX: You receive a &quot;Cannot generate SSPI context&quot; error message when you try to connect to a SQL Server 2000 SP3 server computer

Note You can use the hotfix that is mentioned in this article to resolve this problem even if this problem occurs on a computer that is not running Microsoft Windows XP.



WORKAROUND
To work around this problem, manually create a host entry on the client computer for the IP address that you use to connect to the server computer that is running SQL Server 2000 SP3. For additional information about the steps to work around this problem and the steps to reproduce the behavior, click the following article number to view the article in the Microsoft Knowledge Base:

843248 FIX: You receive a &quot;Cannot generate SSPI context&quot; error message when you try to connect to a SQL Server 2000 S843248 server computer



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section. This problem was corrected in Microsoft Data Access Components 2.8 Service Pack 1.

