Problem while accessing java code from oracle [message #217175] |
Wed, 31 January 2007 23:54  |
agrawal_vaibhao
Messages: 20 Registered: May 2006
|
Junior Member |

|
|
Hi,
I am loading Java class to oracle using loadjava utility and accessing Java code through my oracle stored functions.
It works fine when i load single class and calls its methods within oracle stored function.
But the problem is that when that load two or more classes that are dependent on each other, then those classes are loaded in invalid state in oracle.
And so there was problem while access that Java code in oracle.
Can any one help me !
|
|
|
Re: Problem while accessing java code from oracle [message #217187 is a reply to message #217175] |
Thu, 01 February 2007 01:19   |
sdecman
Messages: 20 Registered: July 2005 Location: Ljubljana, Slovenia
|
Junior Member |
|
|
There are many things that can go wrong with loading java and by executing java classes as well. Hence, why use java in the first place? But sometimes we just can't go without.
We need some example(s) in order to be of some use. We need to get started somewhere. Are the procedures inside classes public? Are they static? Are classes part of the same package?
Try to compile classes manually:
SDECMAN@O102> SELECT dbms_java.longname(object_name) as class_name,
2 status
3 FROM user_objects
4 WHERE object_type = 'JAVA CLASS'
5 AND status = 'INVALID';
CLASS_NAME STATUS
------------------------------ -------
test1/TestClass2 INVALID
SDECMAN@O102> ALTER JAVA CLASS "test1/TestClass2" COMPILE;
Warning: Java altered with compilation errors.
SDECMAN@O102> show errors
Errors for JAVA CLASS /aab9b48_TestClass2:
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 ORA-29521: referenced name test1/TestClass1 could not be found
If the ERROR isn't explainatory enough, post it and we'll try to go from there.
Cheers
|
|
|
|
Re: Problem while accessing java code from oracle [message #217212 is a reply to message #217204] |
Thu, 01 February 2007 03:35   |
sdecman
Messages: 20 Registered: July 2005 Location: Ljubljana, Slovenia
|
Junior Member |
|
|
Quote: |
But the problem is that when that load two or more classes that are dependent on each other, then those classes are loaded in invalid state in oracle.
And so there was problem while access that Java code in oracle.
|
Your problem is not invalid state of java classes in Oracle then. Your problem is INSIDE the java source - the call returns Java exception. But there is still not enough information to say anything. Tell me, which java class is mapped to your PL/SQL's encrypt function? It would be best to see the source code of the java classes involved but because of the nature of use (Cryptography) is probably not an option. Furthermore, what is the platform of your Oracle server (JVM on IBM z/OS is buggy to say at least)? What is your JVM version on your client machine and what is the JVM version inside Oracle? Do they differ?
Cheers
|
|
|
|
Re: Problem while accessing java code from oracle [message #217223 is a reply to message #217215] |
Thu, 01 February 2007 04:12  |
sdecman
Messages: 20 Registered: July 2005 Location: Ljubljana, Slovenia
|
Junior Member |
|
|
Quote: |
Actually in java code we are calling some file that that contain encryption key.
i have loaded that file also using loadjava.
Is there may be problem while refering to that file?
|
Maybe, I have never tried to read file inside Oracle. However this is wrong approach right from the start. I would use Oracle's built-in functions (DBMS_CRYPTO package) and that would eliminate the need for java in the first place.
But if you insist using java for encryption, I would advise you to store the encryption key inside Oracle table (not inside a file!). It would ease the administration of the key greatly because you would need just one simple update to change that key -- not the new file upload.
But me not being the best security expert, I would think that the best key storage would be not to store the key at all... If the key doesn't change on regular basis might as well be hard coded.
Cheers
|
|
|