Microsoft KB Archive/167907

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft Visual C++, 32-bit Editions, versions 2.0, 2.1, 2.2, 4.0, 4.0a, 4.1, 4.2, 5.0, 6.0

-

SUMMARY
There are some limitations when you use the Access ODBC Driver in multi- threaded applications.

MORE INFORMATION
The Versions of the Access ODBC driver that shipped with versions 4.2 and earlier of Visual C++ (or as version 3.0 of the desktop drivers) has limitations when you use it in multithreaded applications. You cannot pass connection and statement handle values from one thread to another. This also means that CDatabase and CRecordset MFC objects cannot be shared between threads.

The reason for this is that the Jet database engine utilized VBA, which supports the Apartment Model of thread safety rather than free-thread safety. Although the Access ODBC Driver, internally, put a critical section around every call to the Jet engine, the use of VBA made the sharing of connection and statement handles unsafe. As long as the thread in the application that initiated a connection to the Access Driver is the only one that does work on that connection, everything is fine. However, it is not safe to pass the connection handle onto another thread and have that thread do work on that connection.

Additional query words: kbvc200 kbvc210 kbvc220 kbvc400 kbvc410 kbvc420 kbvc500 kbdse kbAccess kbVBA kbMFC

Keywords :

Version :

Platform : NT WINDOWS

Issue type : kbinfo
 * }