Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting classpath for a Java stored procedure in Oracle

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?

like image 657
Chris Farmer Avatar asked Feb 09 '09 19:02

Chris Farmer


People also ask

Where can I find JVM CLASSPATH?

To check our CLASSPATH on Windows we can open a command prompt and type echo %CLASSPATH%. To check it on a Mac you need to open a terminal and type echo $CLASSPATH.

How do you assign values for path and CLASSPATH variable in Java?

Click the 'Environment variables' button under the 'Advanced' tab. Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.

How do I change the CLASSPATH of a jar file?

Choose Properties from the context menu. Click the Advanced system settings link (a pop-up box will open). Click Environment Variables. In the section System Variables, find the CLASSPATH environment variable and select it.


1 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.

like image 183
Edwin Avatar answered Oct 13 '22 03:10

Edwin