JDBC Drivers:  Types and Specifics to Oracle.

(adapted from http://tns.sdsu.edu/~diebel/jdbc/jdbcoci2.htm#422133)

JDBC

is a set of classes and interfaces written in Java to allow other Java programs to send SQL statements to a relational database management system.

 

JDBC Driver

This is Java Code that implements JDBC classes and methods in a way that is specific to the database being used. You will get these drivers from the Database Manufacuter.

There are different types of drivers that distinguish how this implementation and connection to the database is achieved.

 

Types of JDBC Drivers

Type 1

  • JDBC-ODBC Bridge plus ODBC Driver:
  • This combination provides JDBC access via ODBC drivers. ODBC binary code--and in many cases, database client code-- must be loaded on each client machine that uses a JDBC-ODBC Bridge. Sun provides a JDBC-ODBC Bridge driver, which is appropriate for experimental use and for situations in which no other driver is available.
  • You can get at JDBC-ODBC driver here or by looking on the java.sun.com page.

Requirements

  • You will get the ODBC driver from your Database manufacturer
  • You will install both the ODBC driver and the JDBC-ODBC bridge driver on each client machine.

Type 2

  • A native-API partly Java technology-enabled driver:
  • Converts JDBC calls into calls on the client API for Oracle, Sybase, Informix, DB2, or other DBMS. Note that, like the bridge driver, this style of driver requires that some binary code be loaded on each client machine.

Requirements

  • You will get this type of driver from your Database manufacturer and you install it on each client machine.

Type 3

  • Pure Java Driver for Database Middleware: This style of driver translates JDBC calls into the middleware vendor's protocol, which is then translated to a DBMS protocol by a middleware server. The middleware provides connectivity to many different databases.

Requirements

  • You will need to purchase the middleware software and do the appropriate installation on the server.
  • You will need to download to the client only the driver provided by the middleware manufacuter.
  • Look here for some vendor listings.

Type 4

  • Direct-to-Database Pure Java Driver: This style of driver converts JDBC calls into the network protocol used directly by DBMSs, allowing a direct call from the client machine to the DBMS server and providing a practical solution for intranet access.

Requirements

  • You will need to download only the driver to the client provided by the database manufacturer.

TYPE 1                               TYPE 2

 

from java.sun.com

TYPE 4                          TYPE 3

from java.sun.com

 

 

Oracle provides the following commonly used JDBC drivers:

OCI Driver

sometimes called FAT driver

  • TYPE 2 driver
  • Applications ONLY
  • Makes Java methods calls to entrypoint in an underlying C library called OCI.
  • OCI (Oracle Call Interface) library
    • interacts with Oracle Client Software pre-installed on client machine to make database requests.
  • You must use a JDBC OCI driver appropriate to your Oracle client installation. OCI is a client side program. (see requirements below).
  • Because they use native methods, they are platform specific

THIN Driver

  • TYPE 4 driver
  • Applets OR Applications
  • Completely written in Java
  • Makes direct connection to database.
  • Uses Java sockets to connect directly to Oracle. It provides its own implementation of a TCP/IP version of Oracle's SQL*Net.
  • Because it is 100% Java, this driver is platform independent.

Requirements

  • Install driver on each client
  • MUST INSTALL Oracle Client software such as SQLPlus, Net8, etc.
  • Must setup configuration file (tsanames.ora) on client machine to point to each database wish to connect to.

Requirements

  • Install driver on each client (or in case of applet download with applet code).

Common Uses

  • To connect directly from a application to a database via OCI
  • Used in a middleware application. The client application "talks to" this middleware JDBC application that uses OCI to connect to the database.

Illustration

from www.oracle.com

Requirements

  • Used by Applets to directly connect to a database
  • Used by Applications where do not wish to install Oracle Client (OCI) software on the client.

Illustration

from www.oracle.com

 

The Oracle Call Interface (OCI) is an application programming interface to Oracle databases. It consists of a library of C language routines to allow C programs (or programs written in other third generation languages) to send SQL statements to the database and interact with it in other ways.
 
 

 

 

Be CAREFULL About the version of Drivers you use!!!!!!!!!!!!!!

Either of these client versions can access Oracle7 or Oracle8 servers.

Because Java has undergone significant changes over its brief life, you must use a version that matches your Java Development Kit.
 
 

The Java classes for JDK 1.0.2 contain the JDBC 1.22 classes from Javasoft. The Java classes for JDK 1.1.1 do not contain the JDBC classes, because those are a standard part of JDK 1.1.1.

 


SPECIAL NOTES

The JDBC Thin driver is appropriate for use by Java applets that can be downloaded into a web browser. It is entirely self contained, requiring no Oracle-specific software or files on the client side. It does, however, need to open a Java socket. It cannot run successfully in a browser that does not allow that operation.