You have a java code running under Oracle Database and needs to adjust the privileges to run the code.
Cause:
Some exemple of errors when trying to execute your java code:
"the Permission ("java.io.FilePermission" "/u01/data/yourfile.dat" "write") has not been granted to <YOUR-USER>. The PL/SQL to grant this is dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.io.FilePermission', '/u01/data/yourfile.dat', 'write' )"
or
"the Permission ("java.net.SocketPermission" "localhost:0" "listen,resolve") has not been granted to <YOUR-USER>. The PL/SQL to grant this is dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.net.SocketPermission', 'localhost:0', 'listen,resolve' )"
Solution:
Set the variables according to your needs and give the privileges:
begin
dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.io.FilePermission', '/u01/data/-', 'read,write,delete' );
dbms_java.grant_permission( '<YOUR-USER>', 'SYS:java.net.SocketPermission', '*', 'accept,listen,connect,resolve' );
end;
/
Note:
A pathname that ends in "/*" (where "/" is the file separator character,File.separatorChar) indicates a directory and all the files contained in that directory.
A pathname that ends with "/-" indicates a directory and (recursively) all files and subdirectories contained in that directory.
Hope this helps.
No comments:
Post a Comment