Databases Reference
In-Depth Information
Each of these functions must include information about the driver in its parameters (in
different forms, however). Using this driver information, the Driver Manager loads the
driver (if it is not already loaded) and calls the appropriate connection function
( SQLConnect , SQLDriverConnect , or SQLDriverBrowse ) in the driver.
When the application is done using the driver, it calls SQLDisconnect . The Driver
Manager passes this call to the driver, which disconnects from the data source.
C.3 The ODBC Driver
An ODBC driver is a code component that implements the functions in the ODBC API.
Each driver is specific to a particular database type. Drivers expose the capabilities of the
underlying database management system (DBMS) but do not, in general, enhance its
capabilities. The main exception is that drivers for DBMSs that do not have standalone
database engines, as is the case with dBASE, Xbase, and ASCII text, for example, must
implement a database engine that supports a minimal amount of SQL.
In particular, an ODBC driver must implement the following tasks (among others):
Connecting to and disconnecting from the data source.
Sending data to and retrieving data from the data source.
Checking for API function errors that are not checked by the Driver Manager.
Submitting SQL statements to the data source for execution. For this, the driver
may need to modify the ODBC-style SQL statements to a form of SQL that the
DBMS understands.
C.3.1 Driver Types
In general, there are two types of ODBC drivers. A file-based driver accesses the
physical data in the database directly. Thus, it must process not only ODBC function
calls, but also SQL statements. Put another way, a file-based driver must also be a
database engine that can process ODBC SQL (at a minimum). For example, dBASE
drivers are file-based drivers because dBASE does not provide a standalone database
engine the driver can use.
By contrast, a DBMS-based driver accesses the physical data only through a separate
database engine. In this case the driver processes ODBC calls but passes SQL statements
to the database engine for processing. For example, Microsoft Access provides a
standalone database engine called Jet, so an Access driver can be DBMS-based. (There
are also file-based Access database drivers that communicate directly with MDB files.)
The advantage of DBMS-based drivers is that they can accept and pass along the
DBMS's specific brand of SQL. For instance, a DBMS-based driver for Microsoft
Access can pass Access SQL statements to the Access database ( Jet) engine for
processing. On the other hand, a file-based Access driver, which contains its own
proprietary database engine that accesses MDB files directly, may support only ODBC
 
Search WWH ::




Custom Search