I have created a PL/SQL a Java Source, and privileges have been granted.
The PL/SQL procedure is executing and no error is coming up. Within the JavaSource there is the following unix command:
ls -al > /orion/list/list.txt
the file List.txt is not being created within the directory.
How would i know the problem if no errors are coming up? Could this be a problem of rights being given to oracle from unix.
Oracle is on unix sun solaris
I concur with Stephen ODonnell.
I have implemented the exact same Java functionality (creating a file containing a directory listing) recently.
I needed to grant the following:
-- this grants read privilege on STDIN
EXEC dbms_java.grant_permission(
grantee => '<username>',
permission_type => 'SYS:java.lang.RuntimePermission',
permission_name => 'readFileDescriptor',
permission_action => null
);
-- this grants write permission on STDOUT
EXEC dbms_java.grant_permission(
grantee => '<username>',
permission_type => 'SYS:java.lang.RuntimePermission',
permission_name => 'writeFileDescriptor',
permission_action => null
);
-- this grants execute privilege for the 'ls' command
EXEC dbms_java.grant_permission(
grantee => '<username>',
permission_type => 'SYS:java.io.FilePermission',
permission_name => '/bin/ls',
permission_action => 'execute'
);
-- this grants read, write, delete and execute on all
-- of the referenced directories (subdirectories of <directory>)
EXEC dbms_java.grant_permission(
grantee => '<username>',
permission_type => 'SYS:java.io.FilePermission',
permission_name => '<directory>/-',
permission_action => 'read,write,delete,execute'
);
-- this grants execute on sh
EXEC dbms_java.grant_permission(
grantee => '<username>',
permission_type => 'SYS:java.io.FilePermission',
permission_name => '/bin/sh',
permission_action => 'read,execute'
);
Hope this helps. Ollie.