## PRB: TRACE() Messages Displayed When Opening Database

Q112823

The information in this article applies to:

- The Microsoft Foundation Classes (MFC), included with:
  - Microsoft Visual C++ for Windows, 16-bit edition, version 1.5
  - Microsoft Visual C++, 32-bit Enterprise Edition, version 4.2
  - Microsoft Visual C++, 32-bit Professional Edition, version 4.2

## SYMPTOMS

The following TRACE() messages appear in the Output window when calling CDatabase::Open() or CRecordset::Open():

>        Warning: ODBC Success With Info, Driver's SQLSetConnectOption
>                 failed
>        State:IM006,Native:0,Origin:[Microsoft][ODBC DLL]

>        Driver not capable.
>        State:IM006,Native:0,Origin:[Microsoft][ODBC DLL]
>        State:S1C00,Native:0,Origin:[Microsoft][ODBC Single-Tier Driver]

## CAUSE

In CDatabase::AllocConnect() located in DBCORE.CPP, the Microsoft Foundation Classes (MFC) contain the following line of code:

       AFX_SQL_SYNC(::SQLSetConnectOption(m_hdbc, SQL_LOGIN_TIMEOUT,
             m_dwLoginTimeout));

Because ODBC (Open Database Connectivity) doesn't provide a way to determine whether or not an ODBC driver uses a "login time-out," the database classes always try to set it before trying to connect. If SQLDriverConnect() is called and the driver doesn't support login time- outs, the above ODBC warning messages will occur.

## RESOLUTION

Because these are harmless warnings (that is, connecting was successful), you can ignore the warnings. Keep in mind that the login time-out has no affect on the data source.

## MORE INFORMATION

The debug version of MFC version 2.5 can provide TRACE() diagnostics specifically for the database classes. To enable database TRACE() messages, run the TRACER.EXE program. This program can be executed by clicking the "MFC Trace Options" icon in the Microsoft Visual C++ Program Manager group. When the program is displayed, select the check boxes titled "Enable Tracing" and "DB Tracing".
The TRACE() messages shown above occur only if DB Tracing is enabled.

Additional query words: 1.50 2.50 4.20 error timeout

Keywords : kbDatabase kbMFC kbODBC kbVC kbprb
Issue type : kbprb
Technology : kbAudDeveloper kbMFC

Last Reviewed: May 2, 2001 © 2001 Microsoft Corporation. All rights reserved. Terms of Use.