Oracle8i SQLJ Developer's Guide and Reference Release 3 (8.1.7) Part Number A83723-01 |
Library | Service | Contents | Index

## Introduction

Oracle8i and Oracle SQLJ support user-defined SQL object types (composite data structures), related SQL object reference types, and user-defined SQL collection types. Oracle objects and collections are composite data structures consisting of individual data elements.

Oracle SQLJ supports either strongly typed or weakly typed Java representations of object types, reference types, and collection types to use in iterators or host expressions. Strongly typed representations use a custom Java class that maps to a particular object type, reference type, or collection type and must implement either the JDBC 2.0 standard `java.sql.SQLData` interface or the Oracle `oracle.sql.CustomDatum` interface. Either paradigm is supported by the Oracle JPublisher utility, which you can use to automatically generate custom Java classes. Weakly typed representations use the class `oracle.sql.STRUCT` (for objects), `oracle.sql.REF` (for references), or `oracle.sql.ARRAY` (for collections). (Or, alternatively, you can use standard `java.sql.Struct`, `Ref`, or `Array` objects in a weakly typed scenario.)

Note that using Oracle extensions in your code requires the following:

- Use one of the Oracle JDBC drivers.

- Customize the profiles appropriately (the default customizer, `oracle.sqlj.runtime.util.OraCustomizer`, is recommended).

- Use the Oracle SQLJ runtime when your application runs.

(The Oracle SQLJ runtime and an Oracle JDBC driver are required whenever you use the Oracle customizer, even if you do not actually use Oracle extensions in your code.)

You also must import the `oracle.sql` package, as follows (unless you use the fully qualified class names in your code):

    import oracle.sql.*;

For Oracle-specific semantics-checking, you must use an appropriate checker. The default checker, `oracle.sqlj.checker.OracleChecker`, acts as a front end and will run the appropriate checker based on your environment. This will be one of the Oracle-specific checkers if you are using an Oracle JDBC driver.

For information about translator options relating to semantics-checking, see "Connection Options" and "Semantics-Checking Options".

Notes: This chapter primarily discusses the use of custom Java classes with user-defined types; however, classes implementing `CustomDatum` can be used for other Oracle SQL types as well. A class implementing `CustomDatum` can be employed to perform any kind of desired processing or conversion in the course of transferring data between the database and Java. Custom Java classes for objects, references, and collections are referred to as custom object classes, custom reference classes, and custom collection classes, respectively. The `SQLData` interface is intended only for custom object classes. The `CustomDatum` interface can be used for any custom Java class. User-defined SQL object types and user-defined SQL collection types are referred to as user-defined types (UDTs). For general information about Oracle object features and functionality, see the Oracle8i Application Developer's Guide - Object-Relational Features.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index