views:

38

answers:

1

I'm trying to get the source of a java resource stored in an oracle database using this code (connecting as SYSTEM for testing):

DECLARE
    javalob CLOB;
BEGIN
    DBMS_LOB.CREATETEMPORARY(javalob, false);
    DBMS_JAVA.EXPORT_RESOURCE('RESOURCENAME', 'SCHEMA', javalob);
    DBMS_OUTPUT.PUT_LINE(javalob);
END;

But when I try to run it I get this:

Java call terminated by uncaught Java exception: java.lang.SecurityException: cannot read <Resource Handle: RESOURCENAME|SCHEMA|301> because SYSTEM does not have execute privilege on it

This thing is, I'm not sure how to grant permissions on <Resource Handle: RESOURCENAME|SCHEMA|301>, as this isn't a SQL or PL/SQL object. And why doesn't SYSTEM have access to it anyway?

A: 

the procedure below in dbms_java package may solve your problem:

PROCEDURE grant_permission(
  grantee varchar2, 
  permission_type varchar2,
  permission_name varchar2, 
  permission_action varchar2)

http://download.oracle.com/docs/cd/B14117_01/java.101/b12021/security.htm#i1005789

matafleur
What do I use for `permission_type`, `permission_name` and `permission_action`?
thecoop
my answer as "calling grant_permission" may not be correct, can you please try granting execute on java RESOURCENAME for SYSTEM like:grant execute on java resource RESOURCENAME...
matafleur