Java Reference
In-Depth Information
borrowed some of it from prior art in relational databases. Whereas ODBC is C- and pointer-
based (and void * at that), JDBC is based on Java and is therefore portable as well as being
network-aware and having better type checking.
JDBC comes in two parts: the portable JDBC API provided with Java and the database-spe-
cific driver usually provided by the DBMS vendor or sometimes by a third party. These
drivers have to conform to the Driver interface, and map from the generic calls into
something the existing database code can understand.
JDBC is designed for relational databases only. But JDBC can provide access to any rela-
tional database, be it local or remote (remote databases are accessed just by using a JDBC
URL containing a hostname, in drivers that support this; they are, of course, implemented
under the hood using client sockets, as discussed in Chapter 16 ). In addition to the drivers
from database vendors, versions of the JDK/JRE running on Microsoft Windows provide a
JDBC-ODBC that allows you to use JDBC with an existing Windows database. Its perform-
ance is slightly less than some other drivers because it adds an extra layer, but it does work.
One formerly common form of database that I do not cover is the so-called Xbase format,
which is implemented by several commercial databases (dBase, FoxBase, etc.) common in
the MS-DOS and Windows world. If you wanted to decode such a database in Java, you'd
probably start with the Xbase file format, documented by Erik Bachmann . Alternatively, you
might find a useful driver in the Microsoft ODBC-32 software and use the JDBC-to-ODBC
bridge to convert your data to a newer format such as a relational database.
Another special-purpose database is the DB/DBM file format. This is a key/value store,
something like a java.util.Map but stored on disk, and with a special API to access it.
DBM originated with Bell Labs Unix, was extended to “ndbm” at UC Berkeley, and was
cloned as “gdbm” by the Free Software Foundation. A company called SleepyCat software
was formed to continue development of Berkeley DB, and produced a Java implementation,
but was eventually absorbed by Oracle. This product is not covered here, but you can down-
load it manually from the Oracle website .
This chapter provides an overview of several database techniques, starting with JPA and its
kin Hibernate, and emphasizing JDBC, so that you know what this technology looks and
feels like.
Search WWH ::




Custom Search