INFO: Thread Safety and the Access ODBC DriverID: Q167907
|
There are some limitations when you use the Access ODBC Driver in multi- threaded applications.
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
Last Reviewed: August 8, 1999