Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures

Home

Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips

Books

Submit News
Search the site here...
Search...
 
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

From 221 JDBC drivers find yours one that fits all requirements

JavaFAQ Home » Databases Go to all tips in Databases


Bookmark and Share

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!

 


 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search



Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy