INF: ODBC Messages on SQL Server ConnectionsLast reviewed: March 12, 1997Article ID: Q143339 |
2.50.0121 6.00
WINDOWS
kbusage kberrmsg kkprg
The information in this article applies to:
SUMMARYA successful connection to Microsoft SQL Server using the Microsoft SQL Server ODBC drivers will always return SQL_SUCCESS_WITH_INFO. If the application then calls SQLError() until it returns SQL_NO_DATA_FOUND there will be at least one 5703 and one or two 5701 messages.
MORE INFORMATIONSQL Server always issues at least two informational messages on a successful connection from any ODBC or DB-library client: A 5701 message, indicating which database on the server the user has been logged into, and a 5703 message, indicating what language the server is using. SQL Server's DB-library API and the Microsoft SQL Server ODBC driver always make these messages available on successful connects in case the application needs to use this information. When an ODBC application calls SQLError() after getting SQL_SUCCESS_WITH_INFO, it should expect the following messages:
Full Connect: szSqlState = "01000", *pfNativeError = 5701, szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server] Changed database context to 'master'." szSqlState = "01000", *pfNativeError = 5703, szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server] Changed language setting to 'us_english'." szSqlState = "01000", *pfNativeError = 5701, szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server] Changed database context to 'pubs'." Successfully connected to DSN 'ab60def'.Applications can simply ignore these 5701 and 5703 messages, they are purely informational. Applications cannot, however, ignore a return of SQL_SUCCESS_WITH_INFO return code on the SQLConnect(), SQLDriverConnect(), or SQLBrowseConnect(). This is because messages other than 5701s and 5703s may be returned that do require action. For example, if a driver connects to a SQL Server with outdated system stored procedures, the following will be one of the messages returned through SQLError():
SqlState: 01000 pfNative: 0 szErrorMsg: "[Microsoft][ODBC SQL Server Driver]The ODBC catalog stored procedures installed on server ab421def are version 02.00.4127; version 06.00.0115 or later is required to ensure proper operation. Please contact your system administrator."Applications need to code their error handling routines for SQL Server connections to call SQLError() until it returns SQL_NO_DATA_FOUND, and act on any messages other than the ones that return a pfNative code of 5701 or 5703.
|
Additional reference words: 2.50.0121 6.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |