I have simple java class that calculates SHA1 and I want to use it from PLSQL procedures in Oracle. Following advises from : SHA1, SHA256, SHA512 in Oracle for free without using DBMS_CRYPTO (my simple case use unly SHA1 and do not need any jars and consist of only sha1.class that imports java.security and java.io)
I compiled sha1.java with:
javac -target 1.2 -source 1.2 sha1.java
and installed this sha1.class on my Windows test environment:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
Unfortunately I have to install it on Solaris with:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
I tried but those attempts fails with:
c:\test>loadjava -thin -user ***** -resolve sha1.class
Error while creating class sha1
ORA-29545: badly formed class:: User has attempted to load a class (sha1) into a restricted package. Permission can be granted using dbms_java
.grant_permission(<user>, LoadClassInPackage...
The following operations failed
class sha1: creation
exiting : Failures occurred during processing
EDITED:
I tried with .java source instead of .class and I got (translated from Polish)::
c:\mn>loadjava -thin -user ****** -resolve sha1.java
Error while creating sha1
ORA-06576: not a valid function or procedure name
Error while computing shortname of sha1
ORA-06550: line 1, column 13:
PLS-00201: must be declared 'DBMS_JAVA.SHORTNAME' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
The following operations failed
source sha1: creation
exiting : Failures occurred during processing
What should I do to load this class or source to Oracle on Solaris?