Using loadjava

The loadjava utility is an operating system command-line utility that uploads Java files into the database. The first time you run loadjava in a schema, it creates a number of objects in your local schema; although the exact list varies somewhat by Oracle version, you are likely to find at least the following in your default tablespace:

CREATE$JAVA$LOB$TABLE

A table created in each schema, containing Java code elements. Each new class you load using loadjava will generate one row in this table, putting the bytes of the class into a BLOB column.

SYS_C ... (exact name will vary)

Unique index on the above table.

SYS_IL ... (exact name will vary)

LOB index on the above table.

By the way, if you don’t have permissions or quota available to create these objects in your default tablespace, the load operation will fail.

Before executing the load, Oracle will check to see if the object being loaded already exists, and whether it has changed, thereby minimizing the need to reload and avoiding invalidation of dependent classes.[46]

The load operation then calls the DDL command CREATE JAVA to load the Java classes from the BLOB column of CREATE$JAVA$LOB$TABLE into the RDBMS as schema objects. This loading occurs only if:

  • The class is being loaded for the first time.

  • The class has been changed.

  • The -force option is supplied.

Here is the basic syntax :

loadjava {-user | -u} username/password[@database]
  [option ...] filename [filename ]...

where filename is a Java source, sqlj, class, .jar, resource, ...

Get Oracle PL/SQL Programming, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.