Architecture

The Desktop Database Drivers are two-tier drivers. In a two-tier configuration, the driver does not perform the process of parsing, validating, optimizing, and executing the query. Instead, Microsoft Jet performs these tasks. It processes ODBC API calls and acts as an SQL engine. Microsoft Jet has become an integral, inseparable part of the drivers: It is shipped with the drivers and resides with the drivers, even if no other application on the machine uses it.

The Desktop Database Drivers consist of six different drivers — or, more precisely, one driver file (ODBCJT32.DLL) that the ODBC Driver Manager uses in six different ways. The DRIVERID flag in the registry entry for a data source determines which driver in ODBCJT32.DLL the Driver Manager uses. An application passes this flag in the connection string included in a call to SQLDriverConnect. By default, the flag is the ID of the Microsoft Access driver.

The driver setup file changes the DRIVERID flag at setup time. All drivers except the Microsoft Access driver have an associated setup dynamic-link library (DLL). When you click the Setup button in the ODBC Administrator for a data source, the ODBC installer DLL (ODBCINST.DLL) loads the setup DLL. The setup DLL exports the ODBC installer function SQLConfigDataSource. If a window handle is passed to SQLConfigDataSource, this function displays a setup window and changes the DRIVERID flag according to the driver selected from the user interface.

When a file is created programmatically, a NULL window handle is passed to SQLConfigDataSource, and the function creates a data source dynamically, changing the DRIVERID flag according to the lpszDriver argument in the function call. For more information, see the Creating .MDB Files Programmatically section later in this chapter.

ODBCJT32.DLL implements ODBC functions on top of the Microsoft Jet API. There is no direct mapping between ODBC and Microsoft Jet functions, however. Many factors, such as the cursor models and SQL mapping, prevent a direct correlation of the functions.

The ODBC driver resides between the Microsoft Jet engine and the ODBC Driver Manager. Some ODBC functions called by an application are handled by the Driver Manager and not passed to the driver. For these functions, Microsoft Jet never sees the function call because it does not have a direct connection to the Driver Manager.

The following figure illustrates the Desktop Database Drivers architecture.

Figure 12.1 Desktop Database Drivers architecture