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?
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.
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'.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With