DBMS
 

 

The Myths Behind ODBC: A Contrary View

By Richard Finkelstein
DBMS, March 1994

Many organizations and developers have high hopes for ODBC, based on wild vendor claims. ODBC is supposed to make applications more portable without sacrificing functionality, performance, or stability. ODBC is also supposed to reduce programmer training and programming efforts, as developers have to learn only one application programming interface (API) in order to access any type of database. But, like all things that are too good to be true, ODBC is having a hard time living up to its reputation.

ODBC and Portability

One of the primary objectives of ODBC is to free organizations from dependence on a specific DBMS. An organization that develops an application using Oracle could theoretically unplug Oracle and put Sybase in its place. However, Oracle and Sybase have significant differences in their architectures and it is difficult, if not impossible, to design (much less program) an application that works equally well with either RDBMS.

Oracle, Sybase, DB2, and Access have far more differences than similarities. In fact, they share very few features. Basic SQL syntax may be the same, but each has many SQL extensions and even those SQL statements that are the same may return different results and definitely exhibit different performance characteristics. Each RDBMS also has its own distinctive set of features that go far beyond simple SQL. Every DBMS implements differently (or not at all) capabilities such as transaction management, triggers, stored procedures, built-in functions, data types, error messages and codes, large data type API functions, cursors, and system catalogs.

ODBC does not directly support all functions in all database servers. For this reason, ODBC supports an "escape clause" that allows programs to send a direct API call to the target DBMS. By invoking it, the program immediately loses portability, because the program is now making direct calls to the DBMS API. The net result is a program consisting of a hodgepodge of ODBC and native DBMS API commands.

To code a "portable" application, a project team would have to have in-depth knowledge of all of the differences between all of the target DBMSs. This is a substantial undertaking -- one that is beyond the means of most projects. Even if a project team had sufficient knowledge, it would then be necessary to figure out a design that would work across multiple DBMSs. This too would be a very substantial effort and there is no assurance that the final design would lead to a practical application. An application that is designed using the least-common-denominator approach of ODBC would have to give up so much functionality and would be so poorly optimized for any given RDBMS that it may have no practical value. It would be like designing a dwelling for use in a mountain range, a desert, a forest, and an urban area. An architect would probably come up with a tent. The problem is that not many people in a city want to live in a tent.

Even if you write a portable application, the problem of keeping it portable persists. DBMS and tool vendors constantly change features in their products. A project team would have to find a way to make the code flexible enough to include these changes in the design as each DBMS evolves, and be able to introduce these changes without impacting the overall portability of the design. This effort would be so great that it could be a never-ending task.

Does ODBC Reduce Programmer Workload?

Learning to use ODBC effectively is a daunting task. First, developers must learn the ODBC specification. Developers must not only learn the complete ODBC specification, but they must also learn the various versions of ODBC and the different conformance levels within each version. Developers must then figure out which version and conformance level a particular DBMS and ODBC driver supports. Developers must also keep up with the constant changes in ODBC specifications, ODBC drivers, and native APIs of the targeted DBMSs.

Each time vendors release a new version of their DBMS, they add functions and API calls to support these new functions. ODBC or the corresponding ODBC drivers may not support these functions. Sometimes vendors revamp or change commands within their APIs in order to streamline application development and increase performance. Sybase and Oracle made such changes in the latest releases of their products, and developers must put in the necessary effort to understand the effects of these changes on their programs and program designs.

The ODBC drivers themselves add a degree of uncertainty and instability to the programming process. Some ODBC drivers are developed by DBMS vendors and others are built by third-party vendors. Drivers have various ODBC conformance levels and are programmed depending on how the driver developer interpreted the ODBC specification. Each driver has its individual behavioral characteristics -- and bugs -- which are uncovered by trial and error. Working through each driver can be an exhausting and time-consuming process that adds to the total development time and cost.

Vendor Support of ODBC

ODBC is a great marketing vehicle because it allows vendors to claim support for dozens of different front-end tools and DBMSs merely by providing ODBC support. But those vendors who have been working in the client/server arena for some time know that building quality connections between a front-end tool and even a single DBMS takes lots of time, effort, and money. It is therefore not surprising that all major tool and RDBMS vendors -- even those that support ODBC -- continue to build drivers that support direct calls to target DBMSs such as Oracle, Sybase, and DB2. Whenever I speak with vendors who are exhorting me to recommend ODBC, I ask them why they are still supporting non-ODBC drivers if they are so confident of ODBC technology, and why their customers still inevitably gravitate to direct drivers when building applications. Theoretically, vendors could drop their direct support once they have ODBC, but they do not because they know that direct calls are the most efficient and stable way to connect an application to a target DBMS.

Interestingly, Microsoft representatives recently told me that ODBC was not being marketed as a solution for mission-critical applications. I pointed out that Visual Basic data controls and Access use ODBC, which means that, by their own definition, Visual Basic is not suitable for mission-critical applications. One alternative is to use Microsoft SQL Server Programmerıs Toolkit for Visual Basic to directly access SQL Server without ODBC, but under this scenario you must build custom data controls.

There is also a question regarding RDBMS vendor support for ODBC. Oracle, Sybase, Borland, and IBM have yet to release ODBC drivers. Oracle has instead released Oracle Glue, which is the companyıs own high-level API for Windows programming.

RDBMS vendors are balking because it would be extremely uncomfortable for them if Microsoft controlled the RDBMS API and thereby controlled the design of future versions of their RDBMS. Microsoft controlling the RDBMS API is as illogical as Oracle controlling the Windows API. RDBMS vendors are constantly developing new features and new APIs to support these features, and they will not allow Microsoftıs ODBC specification to restrict them. The competitive, free marketplace requires vendors to build into their products unique features and capabilities so they can continue to support their existing user bases and attract new customers.

The danger for ODBC users is that they may be locked out of future functions, either because the RDBMS vendors delay support for ODBC or because the ODBC specification cannot be revised fast enough to keep up with new RBDMS functionality. This problem will become more obvious as DBMS vendors begin to introduce new "object-oriented" features that will be difficult or impossible to support within the ODBC framework.

When to Use ODBC

Given the very limited (if any) benefits of ODBC, I struggle to find a reason to use it, other than in those situations where there is no choice. If you are going to design applications that access Oracle, Sybase, or any of the major RDBMSs, it is best to choose a front-end tool or language that has direct support for the target RDBMS engines. If you need to use a tool that does not have direct API support for a particular RDBMS, then you may have no choice but to use ODBC. In this case, it would probably be necessary to sacrifice a great deal in functionality, stability, and performance, and you should recognize this during the planning phase of a project.

ODBC is not a free lunch. ODBC forces project teams to deal with added layers of complexity which they definitely do not need, given the already over-complicated world of client/server. Added layers of complexity mean more points of potential failure and more vendors who inevitably point fingers at each other when a problem occurs in client/server connectivity code.

Most vendors will concede that ODBC has many problems but they insist that ODBC is a new technology -- a technology that needs time to "mature." But experimenting with new technology and hoping that it matures can be very risky. Developers already have very tight project deadlines and enough problems stabilizing client/server applications without having to deal with "maturing" technologies. Even if ODBC does mature, it will still provide only very limited benefits -- mostly in cases where users are generating simple SQL queries only.

Some may argue that it is not always possible to go direct; that ODBC -- like airline trips -- makes it possible to take indirect flights where direct flights are not available. But there is a reason most travelers prefer direct flights. Stopovers take extra time. Things can get lost between segments. And it is possible to get held over indefinitely -- especially if you go through Denver in the winter. My recommendation is to take direct flights whenever possible and avoid getting sidetracked -- or sidelined -- by ODBC.


Richard Finkelstein is president of Performance Computing Inc., a database-technology consulting company based in Chicago, Ill.


Subscribe to DBMS and Internet Systems -- It's free for qualified readers in the United States
Table of Contents | Article Index | Search | Site Index | Home

DBMS and Internet Systems (http://www.dbmsmag.com)
Copyright © 1994 Miller Freeman, Inc. ALL RIGHTS RESERVED
Redistribution without permission is prohibited.
Please send questions or comments to dbms@mfi.com
Updated Friday, January 24, 1997