Applications
An important subcategory of generic applications is application development
environments, such as PowerBuilder or Microsoft Visual Basic. Although the
applications constructed with these environments will probably work only with a
single DBMS, the environment itself needs to work with multiple DBMSs.
What all generic applications have in common is that they are highly
interoperable among DBMSs and they need to use ODBC in a relatively generic manner. For
more information about interoperability, see “Choosing a Level of Interoperability” in Chapter 16, “Interoperability.”
The application uses ODBC in such a manner that the application is not tied to
any one DBMS, although it might be tied to a limited number of DBMSs that
provide similar functionality. Thus, the application developer can sell the
application independently from the DBMS. Vertical applications are interoperable when
they are developed but are sometimes modified to include noninteroperable code
once the customer has chosen a DBMS.
A number of tasks are common to all applications, no matter how they use ODBC.
Taken together, they largely define the flow of any ODBC application. The
tasks are:
Because the majority of data access work is done with SQL, the primary task
for which applications use ODBC is to submit SQL statements and retrieve the
results (if any) generated by those statements. Other tasks for which applications
use ODBC include determining and adjusting to driver capabilities and browsing
the database catalog.
Generic Applications. These are also referred to as shrink-wrapped applications or off-the-shelf
applications. Generic applications are designed to work with a variety of
different DBMSs. Examples include a spreadsheet or statistics package that uses ODBC
to import data for further analysis and a word processor that uses ODBC to get
a mailing list from a database.
Vertical Applications. Vertical applications perform a single type of task, such as order entry or
tracking manufacturing data, and work with a database schema that is controlled
by the developer of the application. For a particular customer, the
application works with a single DBMS. For example, a small business might use the
application with dBase, while a large business might use it with Oracle.
Custom Applications. Custom applications are used to perform a specific task in a single company.
For example, an application in a large company might gather sales data from
several divisions (each of which uses a different DBMS) and create a single
report. ODBC is used because it is a common interface and saves programmers from
having to learn multiple interfaces. Such applications are generally not
interoperable and are written to specific DBMSs and drivers.
Select a data source and connect to it.
Submit an SQL statement for execution.
Retrieve results (if any).
Process errors.
Commit or roll back the transaction enclosing the SQL statement.
Disconnect from the data source.