JavaFAQ Home » Databases
Question: I am writing Java program to access a database. I found hundreds of Java
Database drivers (JDBC)! Which one should I use? Please help to choose right JDBC driver...
Answer: You probably mentioned "hundreds" as a total
amount of different drivers.
By article writing time - June 10, 2006 SUN listed on its site 221 JDBC drivers!
To chose a proper Java Database Connection Driver you should consider and
know a few things:
1. Which Database(s) your application is going to work with: MySQL,
2. Type of driver: JDBC-ODBC Bridge, Native-API, JDBC-Net, Native Protocol
Today are known four types of JDBC Drivers. Please look at the descriptions
below and make your choice.
JDBC is a Java API for executing SQL statements. It provides connectivity
between Java-based applications or applets to database systems. The Java API
consists of a set of classes and interfaces written in the Java programming
JDBC provides a standard API, based on the ANSI SQL-92 standard, that allows
database developers to directly invoke SQL commands. As for the Open Database
Connectivity (ODBC) interface, the JDBC interface is based on the Open Group
(formerly X/Open) SQL Call Level Interface (CLI).
The JDBC API is expressed as a series of abstract Java interfaces that allow
an application programmer to open connections to particular databases, execute
SQL statements, and process the results.
1. JDBC-ODBC Bridge
|Provides JDBC access via ODBC
Bridge, translates all JDBC calls into Open DataBase Connectivity calls
(ODBC) and then sends them to the ODBC driver. ODBC driver must present on
|Not pure Java, native code
||Two steps connection: JDBC-ODBC-Database
||Possible to connect to almost any database - ODBC drivers always
included into database package.
||1. Two steps connection: JDBC->ODBC->Database slows down operations
ODBC must be installed on client machine
|Converts JDBC calls into calls on the client API for a specific DBMS.
The client code typically is a library of platform-specific code (such as C
or C++) that is accessed via the Java Native Interface (JNI).
||Faster than type 1 driver
||The database Library must be preloaded on every client machine
approach. the JDBC requests are passed through the network to the
middle-tier server. Then it translates the requests (directly or indirectly)
to the database-specific native-connectivity interface to further the
request to the database server.
middle-tier server is Java based server, it is possible to use a type 1 or
type 2 JDBC driver to do this.
||Three tiers connection.
||This driver is server based and therefore can be optimized much! Does
not require any client side specific libraries. Small to load and fast to
Faster than types 1 and 2 drivers!
|Middle-tier server requires database specific code on it. Also three
tiers connection causes delays
4. Native Protocol
|Client computer directly calls the database
system - uses the network protocol used by specific database system.
||No ODBC translation is required. Very high performance - faster than
types 1 and 2 drivers!
||Every database requires own driver.
http://JavaFAQ.nu when you need more info about Java!
Printer Friendly Page
Send to a Friend
Search here again if you need more info!