I have written a java application that I have loaded into the Oracle JVM.
It was loaded into the schema CODESYS.
Schema CODESYS has had nothing granted to it wrt java permissions. The following returned no rows.
select * from USER_JAVA_POLICY where grantee_name = 'CODESYS';
I then logged in as SYS and granted CODESYS permission to read/write a directory called c:\temp (which exists).
execute dbms_java.grant_permission( 'CODESYS', 'SYS:java.io.FilePermission', 'C:\temp\*', 'read,write' );
Checking CODESYS's permissions:
select * from USER_JAVA_POLICY where grantee_name = 'CODESYS';
KIND GRANTEE_NAME TYPE_SCHEMA TYPE_NAME NAME ACTION ENABLED SEQ
-------- ------------- ----------- ---------------------- --------- ------------- -------- ----
GRANT CODESYS SYS java.io.FilePermission C:\temp\* read,write ENABLED 244
1 rows selected
I then executed the java application from within the database as follows:
EXECUTE exporter.writeshapefile('SELECT mdsys.sdo_geometry(3001,null,mdsys.sdo_point_type(1,2,3),null,null), 232.32 as num from dual','c:\temp','dual.shp',exporter.c_Point_Z, 1, null);
Error starting at line 2 in command:
EXECUTE exporter.writeshapefile('SELECT mdsys.sdo_geometry(3001,null,mdsys.sdo_point_type(1,2,3),null,null), 232.32 as num from dual','c:\temp','dual.shp',exporter.c_Point_Z, 1, null)
Error report:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.RuntimeException: Error generating shapefilethe Permission (java.io.FilePermission c:\temp read) has not been granted to CODESYS.
The PL/SQL to grant this is dbms_java.grant_permission( 'CODESYS', 'SYS:java.io.FilePermission', 'c:\temp', 'read' )
ORA-06512: at "CODESYS.EXPORTER", line 12
ORA-06512: at "CODESYS.EXPORTER", line 31
ORA-06512: at line 1
29532. 00000 - "Java call terminated by uncaught Java exception: %s"
*Cause: A Java exception or error was signaled and could not be
resolved by the Java code.
*Action: Modify Java code, if this behavior is not intended.
This application runs in other 10gR2 databases (I am running 10.2.0.2 on Windows XP) and I am stumped as to how to get Oracle to recognise the permissions I have granted.
regards
SImon