MDAC 2.5 SDK - Technical Articles


 

Open Database Connectivity (ODBC)

ODBC is a C-level application programming interface (API) for SQL data stores and provides a common interface for accessing heterogeneous SQL databases. ODBC is based on SQL as a standard for accessing data. ODBC’s consistent interface provides maximum interoperability: A single application can access different database management systems (DBMSs) through a common set of code.

This enables a developer to build and distribute a client/server application without targeting a specific DBMS or having to know specific details of various back-end data stores. When an application needs to get data from a data store, the application sends a SQL statement to the ODBC Driver Manager, which then loads the ODBC drivers required to talk to the data. The driver then translates the SQL sent by the application into the SQL used by the DBMS and sends it to the back-end database. The DBMS retrieves the data and passes it back to the application through the driver and the Driver Manager.

Developers can code directly to the ODBC API by declaring various functions and then using them to connect, send SQL statements, retrieve results, get errors, disconnect, and so on. However, it is fairly difficult and involves a lot of code. Because of this, ADO, RDO, and DAO are used more often to access ODBC data from applications.

ODBC has been the data access standard since 1992 and has played a very important role in enabling client/server applications. There are more than 170 ODBC drivers available. With well-written drivers, ODBC performance is excellent. In the short and medium term, ODBC is the best way to access a broad range of relational data due to the high number of available drivers.

ODBC Administrator

The Microsoft ODBC Data Source Administrator manages database drivers and data sources. On computers running the Microsoft Windows 2000 operating system, this application is located in the Windows Control Panel under Administrative Tools. Its icon is named Data Sources (ODBC). On computers running previous versions of Microsoft Windows, the ODBC Administrator icon in the Control Panel is named 32-bit ODBC or simply ODBC.

Driver Manager

The Driver Manager determines the final order in which to return status records that it generates. In particular, it determines which record has the highest rank and is to be returned first. The driver is responsible for ordering status records that it generates. If status records are posted by both the Driver Manager and the driver, the Driver Manager is responsible for ordering them.

The Driver Manager does as much error checking as it can. This saves every driver from checking for the same errors. For example, if a function argument accepts a discrete number of values, such as Operation in SQLSetPos, the Driver Manager checks that the specified value is legal.