2

I need to upload a jar file in Oracle RDBMS using dbms_java.loadjava method. I have granted all the required permission and able to run below function successfully.

create or replace function get_java_property(prop in varchar2)
return varchar2 is
language java name 'java.lang.System.getProperty(java.lang.String) return java.lang.String';

select get_java_property('java.version') from dual;

1.8.0_231

However, I also need to upload an external jar and use the same. I am successfully able to do the same by placing jar on Oracle Server and running loadjava command. However I want to do the same using dbms_java.loadjava from my local system. I am trying following query.

call dbms_java.loadjava('–proxy -Dhttp.proxyHost=my_local_system_ip -Dhttp.proxyPort=22 file:///home/Documents/abc.jar');

Its returning Call completed. However, jar is not uploaded as I have tried to access methods in Jar and getting error

ORA-29540: class com/pkg_name/function_name does not exist
29540. 00000 -  "class %s does not exist"  
*Cause:    Java method execution failed to find a class with the indicated name.
*Action:   Correct the name or add the missing Java class.

However same methods are accessible when jar is uploaded through loadjava command. Please suggest. May be I am missing some basics.

1 Answers1

1

When loading from a local file you don't have to use the -proxy switch:

call dbms_java.loadjava('//home/Documents/abc.jar');

Note: The path must reside on the database server machine