I have granted read, write access to the following directory and sub-directories -- my understanding is that the dash (-) will grant access to all subdirectories.
begin
dbms_java.grant_permission('NWPS','SYS:java.io.FilePermission','/interface/-','read,write,delete') ;
end ;
Here is my class file:
create or replace and compile java source named nwps.hosttest as
import java.io.* ;
import java.util.Date ;
import java.text.* ;
public class HostTest
{
public static final void runFrdayProcessi()
throws IOException
{ String currentDate = null ;
/* get the current date and append it to logFile variable */
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss") ;
Date date = new Date() ;
currentDate = dateFormat.format(date) ;
String logFile = "/interface/ccc/logs/ccc_dme_fri_" + currentDate + ".log" ;
/* OFFENDING LINE OF CODE */
PrintWriter outputStream = new PrintWriter(new FileWriter(logFile)) ;
outputStream.println("Log Date: " + currentDate ) ;
/* close streams */
outputStream.close() ;
}
}
I created a PL/SQL package to run my java file and it compiles fine. Here is the result:
exec jimmyb.npcc_utils_pkg.npcc_friday_run
ORA-29532: Java call terminated by uncaught Java exception: java.io.IOException:
Error processing file: java.io.FileNotFoundException:Permission denied
Any suggestions on why I am getting a permissions error?