ODBC Architecture

ODBC Architecture

Figure 11-3 shows the components of the ODBC standard. The application program, driver manager, and DBMS drivers all reside on the application server computer. The drivers send requests to data sources, which reside on the database server. According to the standard, an ODBC data source is the database and its associated DBMS, operating system, and network platform. An ODBC data source can be a relational database; it can also be a file server, such as BTrieve, or even a spreadsheet.

The application issues requests to create a connection with a data source; to issue SQL statements and receive results; to process errors; and to start, commit, and roll back

Figure 11-2

Relational Databases: Oracle Database,

Role of the ODBC Standard

Native

DBMS

Microsoft SQL Server,

Interfaces

Oracle MySQL, Microsoft Access, IBM DB2 . . .

Browser

ODBC

Nonrelational Databases

VSAM, ISAM, Other

Browser

Web Server

File Processors

Browser

E-mail, Other Document Types

Pictures, Audio, Other????

Part 5 Database Access Standards

Application Server

Data Sources

DBMS Driver 1 DBMS 1 DB

Driver Application Manager DBMS Driver 2 DBMS 2

DB

DBMS Driver 3 DBMS 3

DB

Figure 11-3

Application can process a database using any of the three ODBC Architecture

DBMS products.

transactions. ODBC provides a standard means for each of these requests, and it defines a standard set of error codes and messages.

The ODBC driver manager serves as an intermediary between the application and the DBMS drivers. When the application requests a connection, the driver manager determines the type of DBMS that processes a given ODBC data source and loads that driver into memory (if it is not already loaded). The driver manager also processes certain initialization requests and validates the format and order of ODBC requests that it receives from the application. For Windows, the driver manager is provided by Microsoft.

An ODBC driver processes ODBC requests and submits specific SQL statements to a given type of data source. Each data source type has a different driver. For example, there are drivers for SQL Server, for Oracle Database, for MySQL, for Microsoft Access, and for all of the other products whose vendors have chosen to participate in the ODBC standard. Drivers are supplied by DBMS vendors and by independent software companies.

It is the responsibility of the driver to ensure that standard ODBC commands execute correctly. In some cases, if the data source is itself not SQL compliant, the driver may need to perform considerable processing to fill in for a lack of capability at the data source. In other cases, when the data source supports full SQL, the driver need only pass the request through for processing by the data source. The driver also converts data source error codes and messages into the ODBC standard codes and messages.

ODBC identifies two types of drivers: single tier and multiple tier. An ODBC single-tier driver processes both ODBC calls and SQL statements. An example of a single-tier driver is shown in Figure 11-4 (a). In this example, the data are stored in Xbase files (the format used by FoxPro, dBase, and others). Because Xbase file managers do not process SQL, it is the job of the driver to translate the SQL request into Xbase file-manipulation commands and to transform the results back into SQL form.

An ODBC multiple-tier driver processes ODBC calls, but passes the SQL requests directly to the database server. Although it may reformat an SQL request to conform to the dialect of a particular data source, it does not process the SQL. An example of the use of a multiple-tier driver is shown in Figure 11-4 (b).