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

Part Number A83724-01


Solution Area



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

Support Features of the Oracle Extensions

The Oracle extensions to JDBC include a number of features that enhance your ability to work with Oracle databases. Among these are support for Oracle datatypes, Oracle objects, and specific schema naming.

Support for Oracle Datatypes

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 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 the necessary methods to convert data to appropriate Java formats. For a more detailed description of these general issues, see "Package oracle.sql".

See the following for more information on specific oracle.sql.* datatype classes:

Support for Oracle Objects

Oracle8i 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:

Oracle objects can be mapped either to the weak java.sql.Struct or oracle.sql.STRUCT types or to strongly typed customized classes. These strong types are referred to as custom Java classes, must implement either the standard java.sql.SQLData interface or the Oracle extension oracle.sql.CustomDatum interface, and are described in detail in Chapter 8, "Working with Oracle Object Types". Each interface specifies methods to convert data between SQL and Java.

To create custom 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 performs this task seamlessly with command-line options and can generate either SQLData or CustomDatum implementations.

For SQLData implementations, 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.


Oracle recommends using the CustomDatum interface, instead of the SQLData interface, in situations where portability is not a concern. CustomDatum works more easily and flexibly in conjunction with other features of the Oracle Java platform offerings.  

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

Chapter 8, "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:

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

All Rights Reserved.


Solution Area