Accessing Oracle Objects and PL/SQL Packages using Java

Use JPublisher to access Oracle objects and PL/SQL packages from your Java programs. JPublisher lets you specify and customize the mapping of Oracle object types, reference types, and collection types to Java classes in a strongly typed paradigm.

Also, SQLJ programmers who want to call stored procedures declared in PL/SQL packages can use JPublisher to generate SQLJ wrapper classes for the packages. The SQLJ wrapper classes let you invoke the PL/SQL stored procedures, and pass and return values from them, directly from your SQLJ program.

To access Oracle objects and PL/SQL packages using Java:

  1. Create the desired object datatypes (Oracle objects) and PL/SQL packages in the database. It is recommended that any custom classes or interfaces you use in Oracle Database implement the oracle.sql.CustomDatum interface.
  2. Use JPublisher to generate source code — Java and SQLJ files — that represents the Oracle objects, PL/SQL packages, user-defined types, and REF types.
  3. Import these classes into your application code.
  4. Use the methods in the generated classes to access and manipulate the Oracle Objects and their attributes.
  5. Compile all classes (the JPublisher-generated code and your code). The SQLJ compiler compiles the .sqlj files, and the Java or SQLJ compiler compiles the .java files.
  6. Run your compiled application.

This process is illustrated in the following figure:

figure described in text

Using SQL in Java Programs
About JPublisher
Generating Java Source Code for PL/SQL Programs
Enhancing JPublisher-Generated Classes
Setting JPublisher Parameters
Browsing Databases

 

Copyright © 1997, 2004, Oracle. All rights reserved.