Oracle8i JDBC Developer's Guide and Reference
Release 8.1.5






Prev  Chap Top Next

Introduction to Oracle Extensions

Oracle's implementation of JDBC supports versions 1.0.2 and 1.1.x of the Sun Microsystems JDK and complies with JDBC 1.22, included with these JDK versions. This chapter describes Oracle extensions to JDBC 1.22, organized into two categories:

This section describes how Oracle JDBC supports these extensions, including the Java packages created and the datatype support issues that must be considered.


The JDBC OCI, Thin, and Server drivers support the same functionality, and all of the Oracle extensions.  


Oracle release 8.1.5 does not support JDK 1.2. The JDBC 2.0 interfaces are part of the java.sql package that is included with the JDK 1.2. Therefore, to support JDBC 2.0 types, as well as additional Oracle extensions, the Oracle JDBC distribution includes the following Java packages:

"Oracle JDBC Packages and Classes" further describes these packages and their classes.

Oracle Datatype Support

A key feature of the Oracle JDBC extensions is the type support in the oracle.sql.* package. This package includes classes that map to all of the Oracle SQL datatypes, acting as wrappers for raw SQL data. This functionality provides two significant advantages in manipulating SQL data:

Once manipulations are complete and it is time to output the information, each of the oracle.sql.* type support classes has all of the necessary methods to convert data to appropriate Java formats.

For a more detailed description of these general issues, see "Classes of the oracle.sql Package".

Specific information relating to particular oracle.sql.* datatype classes is discussed in the sections "Working with LOBs" and "Additional Type Extensions".

Oracle Object Support

Perhaps the most noteworthy Oracle8 type is Oracle objects. Oracle8 supports the use of structured objects in the database, where an object datatype is a user-defined type with nested attributes. For example, a user application could define an Employee object type, where each Employee object has a firstname attribute (a character string), a lastname attribute (another character string), and an employeenumber attribute (integer).

Oracle's JDBC implementation supports Oracle object datatypes. When you work with Oracle object datatypes in a Java application you must consider the following:

To manually create Java classes to correspond to your Oracle objects, Oracle recommends that you use the Oracle8i JPublisher utility to create the classes. To do this, you must define attributes according to how you want to store the data. JPublisher handles this task seamlessly with command-line options.

A type map defines the correspondence between Oracle object datatypes and Java classes. Type maps are objects of a special Java class that specify which Java class corresponds to each Oracle object datatype. Oracle JDBC uses these type maps to determine which Java class to instantiate and populate when it retrieves Oracle object data from a result set.

Each Java class created to correspond to an Oracle object datatype must implement one of two supported interfaces: the JDBC-standard SQLData interface or the Oracle CustomDatum interface. Each of these interfaces specifies methods to convert data between SQL and Java. Currently, JPublisher supports only the CustomDatum interface.

JPublisher automatically defines get methods of the Java classes, which retrieve data into your Java application. For more information on the JPublisher utility, see the Oracle8i JPublisher User's Guide.

"Working with Oracle Object Types" describes Oracle JDBC support for Oracle objects.

Support for Schema Naming

Oracle JDBC classes have the ability to accept and return fully qualified schema names. A fully qualified schema name has this syntax:


where schema_name is the name of the schema and sql_type_name is the SQL type name of the object. Notice that the schema_name and the sql_type_name is separated by a dot (".").

To specify an object type in JDBC, you use its fully qualified name (that is, a schema name and SQL type name). It is not necessary to enter a schema name if the type name is in current naming space (that is, the current schema). Schema naming follows these rules:



Copyright © 1999 Oracle Corporation.

All Rights Reserved.