Wednesday, February 27, 2008

What is ODBC?

Open Database Connectivity (ODBC) is a standard software API specification for using database management systems (DBMS). ODBC is designed to be independent of programming language, database system and operating system.

Description
ODBC is a procedural API specification for using SQL queries to access data. An implementation of ODBC will contain one or more applications, a core ODBC library, and one or more "database drivers". The core library is independent of the applications and DBMSes, and acts as an "interpreter" between the applications and the database drivers. The DBMS-specific details are contained in the database drivers. Thus, it is possible to write applications that use standard types and features without concern for the specifics of each DBMS that might be used. Likewise, database driver implementors need only know how to attach to the core library. This makes ODBC modular.

To write ODBC code that exploits DBMS-specific features requires more advanced programming. An application must use introspection, calling ODBC metadata functions that return information about supported features, available types, syntax, limits, isolation levels, driver capabilities and other information.

ODBC is the foremost example of ubiquitous data access because there are hundreds of ODBC drivers for a large variety of data sources. ODBC is available for a variety of operating systems and there are drivers for non-relational data such as spreadsheets, text and XML files. Because ODBC dates back more than ten years, it offers connectivity to a wider variety of data sources than other data access APIs. There are more drivers for ODBC than drivers or providers for newer APIs such as OLE DB, JDBC and ADO.NET.

Despite the benefits of ubiquitous connectivity and platform independence, ODBC has certain drawbacks. Administering a large number of client machines can involve a diversity of drivers and DLLs. This complexity can increase system administration overhead. Large organizations with thousands of PCs have often turned to ODBC server technology to simplify the administration problem.

The layered architecture of ODBC can introduce a minor performance penalty. The overhead of executing an additional layer of code is generally insignificant compared to network latency and other factors that influence query performance. Driver architecture is also a consideration. Many first-generation ODBC drivers operated with database client libraries supplied by a DBMS vendor. An ODBC driver for Oracle, for example, would use Oracle's network library (SQL*Net, Oracle Net) and OCI client library. Similarly, a driver for Sybase or Microsoft SQL Server would use a vendor-supplied network library to emit Tabular Data Stream (TDS) packets. Those earlier drivers have been largely supplanted by wire protocol drivers that do not use database client libraries. The newer type of driver communicates using protocols such as TDS, TNS, and DRDA without needing database client libraries.

Differences between drivers and driver maturity are also important issues. Newer ODBC drivers are often less stable than drivers that have been in production for years. Years of testing and deployment mean a driver is less likely to contain bugs.

To use DBMS-specific features with ODBC, a developer must understand adaptive programming techniques such as introspection and writing interoperable SQL statements. Even when using adaptive techniques, however, some advanced DBMS features might not be available with ODBC. The ODBC 3.x API is well-suited to traditional SQL applications such as OLTP but it has not evolved to support richer types introduced by SQL:1999 and SQL:2003.

Developers needing features or types not accessible with ODBC can use other SQL APIs. When platform independence is not a goal, developers can use proprietary APIs. If creating portable, platform-independent code is a goal, developers can use the JDBC API.

History
ODBC is based on the Call Level Interface (CLI) specifications from SQL Access Group, X/Open (now part of The Open Group), and the ISO/IEC. Microsoft created ODBC by adapting the SQL Access Group CLI. It released ODBC 1.0 in September, 1992. After ODBC 2.0, Microsoft decided to align ODBC 3.0 with the CLI specification making its way through X/Open and ISO. In 1995, SQL/CLI became part of the international SQL standard.

About this Terminology
This terminology is from The Wikipedia which is published under the GNU Free Documentation License.

0 comments: