- Choosing the Appropriate JDBC Driver to Connect to an Oracle Database
- Choosing the Appropriate Driver
Choosing the Appropriate Driver
You should consider some factors when choosing among the various drivers for your application or applet (refer to Table 2, which compares the JDBC thin driver and the JDBC OCI driver):
-
If you are writing an applet, you must use the JDBC thin driver because the JDBC OCI-based driver classes cannot be downloaded to a Web browser.
-
If you need to connect to your Oracle8i data server using an application or an applet, you should choose the JDBC thin driver.
-
If you desire maximum performance from your application, then you should use the JDBC OCI driver.
-
If your Java program is running in the Oracle database server using at least the Oracle 8.1.5 Java VM, you should choose the JDBC Server driver.
Table 1 shows the compatibilities between the different Oracle database versions and the JDBC drivers.
Table 1 Compatibility Between JDBC Drivers and Oracle Databases
Oracle Version |
JDBC Thin Driver |
JDBC OCI Driver |
JDBC Server Driver |
8.1.x |
Yes |
Yes |
Yes |
8.0.x |
Yes |
Yes |
No |
7.x |
Yes |
Yes |
No |
Notes:
-
When run against an 8.1.5 database, both client- and server-side drivers offer full object support.
-
When run against an 8.1.4 database, both client- and server-side drivers offer full object support.
-
When run against an 8.0.x database, the JDBC thin and OCI drivers do not support objects.
-
When run against an 7.x database, the JDBC thin and OCI drivers do not support objects. Also, the JDBC OCI driver does not support LOBs.
Table 2 JDBC OCI and JDBC Thin Drivers Comparison
Feature |
JDBC/OCI Driver |
JDBC Thin Driver |
Applet support |
No |
Yes |
Oracle-specific datatype support |
Yes |
Yes |
National Language support |
Yes |
Yes |
Firewall support |
Works with any SQL*Netcertified firewall |
Works with any SQL*Netcertified firewall |
Support for SQL*Net |
Supports all SQL*Net adapters, including IPC, named pipes, and TCP/IP |
Supports only TCP/IP supported |
Net8 connection manager support |
Yes |
Yes |
Encryption |
Yes, by using the Advanced Networking Option of Net8 |
No |
Driver Type |
Type 2 driver: implements JDBC interfaces that use OCI to interact with the Oracle database |
Type 4 driver: Uses Java sockets to connect directly to the Oracle database |
The only differences between the Oracle JDBC drivers are how they connect to the database and how they transfer data.