Sunteți pe pagina 1din 2

The four driver types are as follows:

Type 1: JDBC bridge driver


This type uses bridge technology to connect a Java client to a third-party API such as Oracle
DataBase Connectivity(ODBC). Sun's JDBC-ODBC bridge is an example of a Type 1 driver.
These drivers are implemented using native code.

Type 2: Native API (part Java driver)


This type of driver wraps a native API with Java classes. The Oracle Call Interface (OCI) driver is
an example of a Type 2 driver. Because a Type 2 driver is implemented using local native code, it
is expected to have better performance than a pure Java driver.

Type 3: Network protocol (pure Java driver)


This type of driver communicates using a network protocol to a middle-tier server. The middle tier
in turn communicates to the database. Oracle does not provide a Type 3 driver. They do,
however, have a program called Connection Manager that, when used in combination with
Oracle's Type 4 driver, acts as a Type 3 driver in many respects.

Type 4: Native protocol (pure Java driver)


This type of driver, written entirely in Java, communicates directly with the database. No local
native code is required. Oracle's Thin driver is an example of a Type 4 driver.

Oracle's JDBC drivers:

JDBC OCI driver


This is a Type 2 driver that uses Oracle's native OCI interface. It's commonly referred to as the
OCI driver. There are actually two separate drivers, one for OCI7 (Oracle release 7.3.x) and
another for OCI8 (Oracle release 8.x). This driver is for client-side use and requires that the
Oracle client software be installed.

JDBC Thin driver


This is a Type 4, 100% pure Java driver for client-side use.

JDBC internal driver


This is a Type 2, native code driver for server-side use with Java code that runs inside the
Oracle8i database's JServer JVM. It's also called the kprb driver.

JDBC server-side Thin driver


This is a Type 4 100% pure Java driver for server-side use with Java code that runs inside the
Oracle8i database's JServer JVM that must also access an external data source.

Oracle driver architecture


Guidelines for choosing an appropriate driver for your applications:

Two-tier client/server application


I suggest you use the Thin driver for all two-tier, client/server applications. The one exception is
for applications making heavy use of stored procedures. For those, you should use the OCI
driver. Note that this is contrary to Oracle's recommendation. Oracle recommends that for
maximum performance, you always use the OCI driver with two-tier, client/server applications. I
disagree with Oracle's recommendation because the difference in performance between the OCI
driver and the Thin driver is nominal in most instances, yet installing the Oracle client software to
support the OCI driver can become a costly software configuration management issue.

Servlet or applet
I suggest you use the Thin driver for portability when writing servlets and applets. For an applet,
you have no choice but to use the Thin driver. It is a pure Java driver that allows a direct
connection to the database by emulating Net8's protocol on top of Java sockets (TCP/IP).

Middle-tier program residing in a database


I suggest you use the server-side internal driver if your program resides in a database and uses
only resources, such as Enterprise JavaBeans (EJB) and stored procedures, in that database.

Middle-tier program residing in a database, but accessing outside resources


For a middle-tier program such as EJB that resides in an Oracle8i database but requires access
to resources outside of the Oracle8i database in which it resides, use the serverside Thin driver.

S-ar putea să vă placă și