Content received from: http://JavaFAQ.nu/java-article1015.html
From 221 JDBC drivers find yours one that fits all requirements Wednesday, June 14, 2006 (00:40:00)
Posted by Javaaddict
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,
Oracle...
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
language.
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.
| Driver Type |
Description |
Pure Java? |
Connection type |
Pros |
Cons |
1. JDBC-ODBC Bridge
|
Provides JDBC access via ODBC
drivers.JDBC-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
client machine. |
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 2.
ODBC must be installed on client machine |
2. Native-API
|
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). |
Partly Java |
Direct |
Faster than type 1 driver |
The database Library must be preloaded on every client machine |
3. JDBC-Net
|
Three-tiered
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.
When the
middle-tier server is Java based server, it is possible to use a type 1 or
type 2 JDBC driver to do this. |
Yes |
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
run. 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. |
Yes |
Direct |
No ODBC translation is required. Very high performance - faster than
types 1 and 2 drivers! |
Every database requires own driver. |
Always visit
http://JavaFAQ.nu when you need more info about Java!
|
|