Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Stored Procedure to read a file

Status
Not open for further replies.

zgrande

Programmer
Mar 18, 2002
15
0
0
BR
Hi,
I need to read data from a file, so I create a Java Stored Procedure, but when I call the procedure this error is returned:

ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.io.FilePermission /PublicFiles/tete.dxf read) has not been granted to TESTDXF. The PL/SQL to grant this is dbms_java.grant_permission('TESTDXF', 'SYS:java.io.FilePermission', '/PublicFiles/tete.dxf', 'read' )

I tried to set the permission using the dbms_java package but I couldn't find the grant_permission procedure, and one more thing, how to set read/write/delete permission to a directory, and not just to a single file?

I'm using Oracle 9i Release 2.

Thanks.
 
Maybe you don't have execute privileges on DBMS_JAVA.GRANT_PERMISSION. If you did, you would need to:-

BEGIN
DBMS_JAVA.GRANT_PERMISSION('your_schemaname',
'java.io.FilePermission',
'your_path_and_file',
'read');

DBMS_JAVA.GRANT_PERMISSION('your_schemaname',
'java.io.RuntimePermission',
'*',
'writeFileDescriptor');
END;
/

The second enables you to output.

To set permissions on the directory, treat it as you would a file in the grant.

However, and this is a very big however. If you need to read a file, why not simply use UTL_FILE? Very easy to use and much easier for other PL/SQL programmers to understand.

Regards

Adrian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top