Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Permission Error Writing File

orclrunnerSep 18 2008 — edited Sep 24 2008
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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2008
Added on Sep 18 2008
2 comments
3,654 views