开发者

What is the equivalent syntax to grant Java running in the embedded Oracle JVM to an Oracle Directory by Name?

To grant java code that is running inside the Oracle JVM built into 10g DBMS to a specific directory on disk I can can execute:

dbms_java.grant_permission( 
        'SCOTT', 
        'SYS:java.io.FilePermission', 
        '/some/path/on/disk', 
         'read');

What is the equivalent syntax to grant Java code running inside the Oracle JVM built into 10g DBMS an Oracle Directory by Name?

dbms_java.grant_permission( 'SCOTT', 
 'SYS:java.io.FilePermission', 
 'SOME_DIRECTORY_IN_ALL_DIRECTORIES_VIEW', 
 'read');

The directory objects can be found here: select * from all_directories

Example entries in all_directories view:

OWNER   DIRECTORY_NAME    DIRECTORY_PATH
SYS     LOG               /export/home/scott/log
SYS     RESPONSE          /export/home/scott/response
SYS     STAGING           /export开发者_运维技巧/home/scott/staging

If there is such a beast, What is the syntax to read from the named directory within the Java code?


Based on what I read in this AskTom question, you'll need something like:

SELECT directory_path INTO v_path
  FROM all_directories
 WHERE directory_name = '<oracle_dir_name>';

dbms_java.grant_permission( 'SCOTT', 
 'SYS:java.io.FilePermission', 
 v_path, 
 'read');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜