Java Reference
In-Depth Information
The Vendor Variation Problem
A fundamental problem that immediately presents itself when attempting to provide
some general access method that will work for all relational databases is how to
cope with the variation in internal format of such databases (and, consequently, the
associated database API) from vendor to vendor. Thus, for example, the internal
format of an Oracle database will be different from that of an Access database,
while the format of a MySQL database will be different from both of these.
In order to use JDBC for the accessing of data from a particular type of relational
database, it is necessary to provide some mediating software that will allow JDBC
to communicate with the vendor-specifi c API for that database. Such software is
referred to as a driver . Suitable drivers are usually supplied either by the database
vendors themselves or by third parties. For information about JDBC 4 drivers
for specifi c databases, visit
drivers/index.html . JDBC drivers may be written purely in Java or in a combination
of Java and Java Native Interface (JNI) methods. (JNI allows Java programmers to
make use of code written in other programming languages.) However, the details
are beyond the scope of this text and no further reference will be made to these
differing categories.
Before Java came onto the scene, Microsoft had introduced its own solution to
the problem of accessing databases that have different internal formats: Open
Database Connectivity (ODBC). Though (not surprisingly) ODBC drivers were
originally available only for Microsoft (MS) databases, other vendors and third
party suppliers have since brought out ODBC drivers for most of the major non-MS
databases. In recognition of this fact, Oracle provides the JDBC-ODBC bridge
driver in package sun.jdbc.odbc , which is included in the Java Standard Edition
(and has been present in Java from JDK 1.1). This driver converts the JDBC
protocol into the corresponding ODBC one and allows Java programmers to access
databases for which there are ODBC drivers. However, adding an extra conversion
phase may lead to unacceptably long delays in some large, database-intensive
applications. In fact, to quote from the JDBC API, “…the bridge driver included
in the SDK is appropriate only for experimental use or when no other driver
is available”.
SQL and Versions of JDBC
The standard means of accessing a relational database is to use SQL (Structured
Query Language). [Readers unfamiliar with SQL are advised to read the appendix
on this subject before proceeding further with this chapter.] This is refl ected in the
fact that the package comprising the core JDBC API is called java.sql.
The original JDBC that was released with JDK 1.1 was JDBC 1.0, which com-
prised package java.sql . Using this API, it is possible to access data not only from
Search WWH ::

Custom Search