Oracle8i JDBC Developer's Guide and Reference
Release 3 (8.1.7)

Part Number A83724-01

Library

Solution Area

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

JDBC 2.0 Support: JDK 1.2.x versus JDK 1.1.x

Support for standard JDBC 2.0 features differs depending on whether you are using JDK 1.2.x or JDK 1.1.x. There are three areas to consider:

This section also discusses performance enhancements available under JDBC 2.0--update batching and fetch size--that are also still available as Oracle extensions, then concludes with a brief discussion about migration from JDK 1.1.x to JDK 1.2.x.

Datatype Support

Oracle JDBC release 8.1.6 and higher fully supports JDK 1.2.x, which includes standard JDBC 2.0 functionality through implementation of interfaces in the standard java.sql package. These interfaces are implemented as appropriate by classes in the oracle.sql and oracle.jdbc.driver packages.

For JDBC 2.0 functionality under JDK 1.2.x, where you are using classes12.zip, no special imports are required. The following imports, both of which you will likely need even if you are not using JDBC 2.0 features, will suffice:

import java.sql.*;
import oracle.sql.*;

JDBC 2.0 features are not supported by JDK 1.1.x; however, Oracle provides extensions that allow you to use a significant subset of JDBC 2.0 datatypes under JDK 1.1.x, where you are using classes111.zip. These extensions support database objects, object references, arrays, and LOBs.

The package oracle.jdbc2 is included in classes111.zip. This package provides interfaces that mimic JDBC 2.0-related interfaces that became standard with JDK 1.2.x for SQL3 and advanced datatypes. The interfaces in oracle.jdbc2 are implemented as appropriate by classes in the oracle.sql package for a JDK 1.1.x environment.

The following imports are required for JDBC 2.0 datatypes under JDK 1.1.x:

import java.sql.*;
import oracle.jdbc2.*;
import oracle.sql.*;

Standard Feature Support

In a JDK 1.2.x environment (using the JDBC classes in classes12.zip), JDBC 2.0 features such as scrollable result sets, updatable result sets, and update batching are supported through methods specified by standard JDBC 2.0 interfaces. Therefore, under JDK 1.2.x, you can use standard objects such as Connection, DatabaseMetaData, ResultSetMetaData, Statement, PreparedStatement, CallableStatement, and ResultSet to use these features.

With release 8.1.6 and higher in a JDK 1.1.x environment (using the JDBC classes in classes111.zip), Oracle JDBC provides support for these JDBC 2.0 features as Oracle extensions. To use this functionality, you must cast your objects to the Oracle types:

For example, to use JDBC 2.0 result set enhancements, you must do the following:

In addition, you might have to cast statement objects to OracleStatement, OraclePreparedStatement, or OracleCallableStatement, and cast database meta data objects to OracleDatabaseMetaData. This would be if you want to use JDBC 2.0 statement or database meta data methods described under "Summary of New Methods for Result Set Enhancements".

Extended Feature Support

With release 8.1.6 and higher, features of the JDBC 2.0 Optional Package (also known as the Standard Extension API), including data sources, connection pooling, and distributed transactions, are supported equally in a JDK 1.2.x or 1.1.x environment.

The standard javax.sql package and classes that implement its interfaces are included in the JDBC classes ZIP file for either environment.

Standard versus Oracle Performance Enhancement APIs

There are two performance enhancements available under JDBC 2.0, which had previously been available as Oracle extensions:

In each case, with release 8.1.6 and higher you have the option of using the standard model or the Oracle model. Do not, however, try to mix usage of the standard model and Oracle model within a single application for either of these features.

For more information, see the following sections:

Migration from JDK 1.1.x to JDK 1.2.x

The only migration requirements in going from JDK 1.1.x to JDK 1.2.x are as follows:

If these points do not apply to your code, then you do not need to make any code changes or recompile to run under JDK 1.2.x.



Go to previous page
Go to beginning of chapter
Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Solution Area

Contents

Index