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.
Notes:
- 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:
Information on installing java
Information on the JDBC API
4 Comments. Leave new
Marcelo,
One small question. I realize that ojdbc4.jar is not distributed with the 11g client (server, or instant client), but I’m pretty sure it is still supported to connect to an 11g database, regardless of what JDK the databases support. Is this documented somewhere?
Did you ever find a reply that whether ojdbc4.jar can be used to connect to 11g ?
Oracle Database 11g Release 2 documentation says:
* 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:
https://java.sun.com/j2se/1.5.0/docs/relnotes/version-5.0.html
https://download.oracle.com/docs/cd/E11882_01/appdev.112/e12137/getstart.htm#TDPJD116
Oracle Database 11g Release 1 (11.1) documentation says:
* In Oracle Database 11g Release 1 (11.1), support for a version of JDK earlier than version 1.5 has been removed. Also, the ojdbc14.jar and classes12.jar files are no longer shipped. Instead, you can use the ojdbc5.jar and ojdbc6.jar files, which are shipped with Oracle Database 11g.
* If you are using JSE 6 and later, then there is no need to explicitly load the JDBC driver. This means that the Java run-time loads the driver when needed and you need not include Class.forName(“oracle.jdbc.OracleDriver”) or new oracle.jdbc.OracleDriver() in your code. But if you are using J2SE 5, then you need to load the JDBC driver explicitly.
https://download.oracle.com/docs/cd/B28359_01/java.111/b31224/getsta.htm#sthref42
Which JDBC driver version goes with which JDK version ?
JDBC Version JDK version** JDBC File Name
11.2.0 1.6.x/1.5.x ojdbc6.jar/ojdbc5.jar
11.1.0 1.6.x/1.5.x ojdbc6.jar/ojdbc5.jar
10.2.0 1.2.x/1.3.x/1.4.x1.5.x classes12.jar/classes12.jar/ojdbc14.jar/ojdbc14.jar
10.1.0 1.2.x/1.3.x1.4.x classes12.jar/classes12.jar/ojdbc14.jar
Starting With Oracle JDBC Drivers [ID 401934.1]
Check out the Easysoft range of JDBC Drivers: https://www.easysoft.com/products/data_access/index.html#jdbc-drivers