Home » Java » Setting classpath for a Java stored procedure in Oracle

Setting classpath for a Java stored procedure in Oracle

Posted by: admin December 28, 2021 Leave a comment

Questions:

I’ve got an Oracle 10g database, and I have a third-party jar file. I want to be able to run a SQL select query in my database that ultimately runs code in my third-party library to retrieve info for inclusion in a SQL result set. I see lots of tutorials on “Java stored procedures” and these seem to be a promising way to do this, but none seem to use third-party libraries, and I can’t seem to figure out how to specify a classpath for my jar file that will be recognized when I am running in Oracle. How can I do this?

Answers:

You can load the JAR file into the database using the loadjava tool.
This tool accepts also .class, .java, .properties, .sqlj, .ser, .jar, or .zip files.

See the manual ( http://docs.oracle.com/cd/B19306_01/java.102/b14187/cheleven.htm#CACFHDJE ) for more information.

###

Try adding the jar to the Windows/Unix CLASSPATH system variable.