Executing Java programs from PL/SQL
Like the C programs, Java programs can also natively execute in the Oracle Database. However, unlike C external programs, the Java classes and Java source files are stored as schema objects in the database.
External Java programs are not executed through OS-based shared libraries but use a Java shared library or libunit for execution. Libunits are similar to dynamically linked libraries but they are mapped one-to-one to the Java class and are not sharable across the other methods.
The libunit is loaded and executed by the Java Virtual Machine (JVM) which resides natively in the Oracle Database. The JVM uses the Java pool component of the shared global area to execute the Java-based external program.
Loading a Java class into a database
A Java program can be loaded into an Oracle Database by using the CREATE JAVA
statement or the LOADJAVA
utility.
The CREATE JAVA
statement enables the Java Virtual Machine library manager to load a Java class into the Oracle...