Using Oracle Database LoadJava


Oracle provides the LoadJava tool to create schema objects from Java source, class, data files or SQLJ files. The LoadJava tool is located in the bin directory under $ORACLE_HOME.

CREATE PROCEDURE and CREATE TABLE privileges are required to load into your schema.

CREATE ANY PROCEDURE and CREATE ANY TABLE privileges are required to load into another schema using the -schema option.

LoadJava can be executed either from the command line or by using the loadjava method contained in the DBMS_JAVA class which allows you to execute from within your Java application.

Command Line Example

loadjava -force -genmissing -r -user scott@orcl-verbose core-1.7.jar

Calling from a Java application

call dbms_java.loadjava(‘… options…’);

The options are the same as those that can be specified on the command line with the loadjava tool. Separate each option with a space. Do not separate the options with a comma. The only exception for this is the -resolver option, which contains spaces. For -resolver, specify all other options in the first input parameter and the -resolver options in the second parameter, as follows:

call dbms_java.loadjava(‘..options…’, ‘resolver_options’);

Do not specify the -thin, -oci, -user, and -password options, because they relate to the database connection for the loadjava command-line tool. The output is directed to stderr. Set serveroutput on, and call dbms_java.set_output, as appropriate.


Discover Your Opportunities

Data Solutions | Application Development | Automation