Java Stored Procedure in Oracle, Database Interaction - Getting Java Classes into Oracle Database (Page 3 of 5 )
The simple Java class we created in the previous section needs to become a full-fledged schema object before it could be accessed, as if it is a native stored procedure. Oracle provides a command-line utility called “loadjava” to accomplish this task. The “loadjava” utility essentially provides an interface for SQL based CREATE JAVA statements, which also may be used to migrate Java-related files to the database.
We need not compile the previous program using the traditional “javac” compiler; “loadjava” does even that for us during its loading process. This is achieved by specifying the -resolve attribute on the utility.
The following commands would help you to know the status of what you created.
SELECT object_name, object_type, status FROM user_objects WHERE object_type LIKE 'JAVA%';
You should attain the “VALID” in the output. Otherwise something is wrong with your program. If you receive any errors, you should query “USER_ERRORS” to view more information and correct them accordingly.