loadjava: Loading Java Sources/Classes/Jars into oracle Database

VijayaTech Labs Blog
Loading the Java Sources/Classes into Database is important thing in Java based application software. Java sources (jar/Classes) can be loaded into database by using few methods, and using loadjava command is one of them.

This is OS based utility tool by Database. This command will be available in the OS. This can be run by Command Prompt (cmd) in Windows or Shell in UNIX/LINUX.

  • Windows:
    1. goto the jar existing path in Command Prompt (cmd)
    2. loadjava -resolve -user scott/tiger@demo SQLJ.jar

    Issue the above command , If the error loadjava command not found is coming up then set environment variables like PATH, JAVA_HOME then issue loadjava command.

  • UNIX/Linux
    1. Set parameters
        To execute the loadjava in server environment directly, it is better to set the following parameters.

      • $ export ORACLE_HOME=/scratch/oracle/app/oracle/product/11.2.0/dbhome_1
      • $ export PATH=$ORACLE_HOME/bin:$PATH:.
      • $ export ORACLE_SID=DEMO
    2. goto the jar existing path in Shell
    3. loadjava -resolve -user scott/tiger@demo SQLJ.jar

ORA-29534: referenced object cannot be resolved
Cause: In case of loading multiple Jars
It might be because the internal sources of a Jar referring to another source in another jar.
So load all the jars at once to avoid the above error as follows

loadjava -resolve -user scott/tiger@demo *.jar

It will load all the jars existing in the folder/directory/path mentioned

Reference Links:
Refer the following links for detailed information of the tool

Share this post with your friends

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top