Choosing the Appropriate JDBC Driver to Connect to an Oracle Database
- Choosing the Appropriate JDBC Driver to Connect to an Oracle Database
- Choosing the Appropriate Driver
Oracle8i provides two different client-side programmatic interfaces for Java developers to access data stored in the database: JDBC and SQLJ (enabling SQL to be embedded in Java). Oracle expert Megh Thakkar discusses the JDBC drivers that can be used and tells how to choose between them.
Oracle8i provides two different client-side programmatic interfaces for Java developers to access data stored in the database: JDBC and SQLJ (enabling SQL to be embedded in Java). This article discusses the JDBC drivers that can be used and tells how to choose between them.
Java Database Connectivity (JDBC) is a standard API that enables application developers to access and manipulate relational databases from within Java programs. The JDBC standard was defined by Sun Microsystems. It enables individual providers to implement and extend the standard with their own JDBC drivers. JDBC is based on the X/Open SQL Call Level Interface (CLI) and complies with the SQL92 Entry Level standard, which provides a DBMS-independent interface that enables access to the database from Java.
The JDBC framework includes a JDBC driver manager and the JDBC drivers. The driver manager can support multiple drivers connecting to different databases. The JDBC drivers can be entirely written in Java so that they can be downloaded as part of an applet, or they can be implemented using native methods to bridge to existing database access libraries.
Oracle JDBC Drivers
Oracle provides three types of JDBC drivers, which you can use for different types of applications:
-
Oracle Thin JDBC driverThis driver is written completely in Java and is only 900KB (compressed), making it ideal for Java applets that can be used with a browser. When you download an applet from an HTML page, the thin JDBC driver is downloaded with it. A direct Net8 connection is established between the applet and database. Scalability is provided with the use of the Net8 connection manager.
-
Oracle JDBC/OCI driverThis driver uses Oracle client libraries such as OCILIB, CORE, and Net8 to provide OCI calls to access the database. You must perform client installation of the JDBC/OCI driver because it is not downloadable. This driver can be used for client/server Java applications, as well as middle-tier Java applications running in a Java application server. However, these JDBC/OCI drivers can't be used with applets.
-
Oracle JDBC Server DriverThe JDBC Server Driver (also referred to as KPRB driver) enables Java programs to use the Oracle8i Java Virtual Machine. The Server Driver runs inside the database to communicate with the SQLEngine. No network round trips are involved because the Server Driver and the SQLEngine both run in the same address space. This driver is for server-side use only and provides server-side JDBC support for any Java program used in the database, Java stored procedure, and Enterprise Java Beans (EJB). In addition, it enables communication with SQL and PL/SQL programs.
The JDBC drivers provided by Oracle have several important features, and they all provide the same functionality:
-
Compliance with JDBC 1.22
-
Support for most of the JDBC 2.0 features
-
The same syntax and APIs
-
The same Oracle extensions
-
Support for Oracle7 and Oracle8 object-relational data types
-
Support for manipulation of LOB data
-
Performance enhancement features such as array interface, prefetching, and batch SQL statement execution
-
Capability to access PL/SQL and Java stored procedures
-
Support for all Oracle character sets
-
Full support for multithreaded applications
NOTE
The JDBC-ODBC bridge driver is the result of a joint effort by JavaSoft and Intersolv. It translates JDBC method calls into ODBC function calls. Using the JDBC-ODBC bridge driver, you can use ODBC from Java.