Choosing the Appropriate Driver
Jan 12, 2011 / By Marcelo Lopes
For this blog I have compiled the main information specifically considering 11gR2 platform, but the concepts and idea also apply for older platforms as well.
Oracle provides the following JDBC drivers:
- Oracle Call Interface (OCI) driver: For client-side use with an Oracle client installation.
- Thin driver: A pure Java driver for client-side use, particularly with applets. It does not require an Oracle client installation.
- Server-side Thin driver: Is functionally the same as the client-side Thin driver, but is for code that runs inside Oracle Database instance and needs to access a remote server.
- Server-side internal driver: For code that runs inside the target server, that is, inside Oracle Database instance that it must access.
Oracle Database 11g provides client-side drivers compatible with Java Development Kit (JDK) 1.5.
The Oracle Java Database Connectivity (JDBC) drivers support different versions of the JDBC standard features. In Oracle Database 11g Release 2 (11.2), Oracle JDBC drivers have been enhanced to provide support for the JDBC 4.0 standards. These features are provided through the oracle.jdbc and oracle.sql packages. These packages support Java Development Kit (JDK) releases 1.5 and 1.6.
As I’m not familiar with your the application, when deciding what database connection or connections you will need for your SQLJ application, consider the following:
- Will you need just one database connection or multiple connections?
- If using multiple connections (possibly to multiple schemas), then will each connection use SQL entities of the same name: tables of the same name, columns of the same name and data types, stored procedures of the same name and signature, and so on?
- Will you need different connections for translation and run time or will the same suffice for both?
In terms of JDBC driver for your application or applet you also should think of:
- In general, unless you need OCI-specific features, such as support for non-TCP/IP networks, use the JDBC Thin driver.
- If you want maximum portability and performance, then use the JDBC Thin driver. You can connect to Oracle Database from either an application or an applet using the JDBC Thin driver.
- If you want to use Lightweight Directory Access Protocol (LDAP) over Secure Sockets Layer (SSL), then use the JDBC Thin driver.
- If you are writing a client application for an Oracle client environment and need OCI-driver-specific features, such as support for non-TCP/IP networks, then use the JDBC OCI driver.
- If you are writing an applet, then you must use the JDBC Thin driver.
- For code that runs in the database server and needs to access a remote database or another session within the same database instance, use the JDBC server-side Thin driver.
- If your code runs inside the database server and needs to access data locally within the session, then use the JDBC server-side internal driver to access that server.
Oracle Database Client installation is optional, but recommended. Installing Oracle Database Client on any computer allows easy access from that system to the Oracle Database. The installation also includes the following development tools:
- Oracle JDBC drivers
- Oracle Open Database Connectivity (ODBC) driver
- Oracle Provider for OLE DB
- Oracle Data Provider for .NET (ODP.NET)
- Oracle Services for Microsoft Transaction Server
The client installation is platform-specific and installing the latest version of client-side (11gR2) can be find here.
- Oracle Database does not support JDK 1.2, JDK 1.3, JDK 1.4, and all classes12*.* files. You need to use the ojdbc5.jar and the ojbc6.jar files with JDK 5.n and JDK 6.n, respectively.
- The oracle.jdbc.driver.* classes, the ojdbc4.jar file, and the OracleConnectionCacheImpl class are no longer supported or available.
- JDK versioning conventions have changed from JDK version 1.n to JDK n. Refer to the Sun Java site at the following location for more information:
Find more about java at: