2
我已經建立2程序和Java源執行的Unix Sun Solaris的命令,使用與
一個過程調用java類TestHostCommand
PROCEDURE TEST2
(p_command IN Varchar2)
AS LANGUAGE JAVA
NAME 'TestHostCommand.executeCommand(java.lang.String)';
Java源代碼的權限ORACLE PL/SQL的麻煩是:
import java.io.*;
public class TestHostCommand
{
public void executeCommand(String command)
{
Runtime rt = Runtime.getRuntime();
Process p = null;
try
{
p = rt.exec("ls > /Orion/list/list.txt");
return;
} catch (IOException ioe)
{
System.out.println("Error executing file");
}
}
}
而另一個過程是授予權限但它生成不正確:
PROCEDURE GRANT_PERMISSION
(grantee IN VARCHAR2,
permission_type IN VARCHAR2,
permission_name IN VARCHAR2,
permission_action IN VARCHAR2)
IS
BEGIN
DBMS_JAVA.grant_permission ('ORION', 'java.io.FilePermission',
'<>', 'read ,write, execute, delete');
DBMS_JAVA.grant_permission ('ORION', 'SYS:java.lang.RuntimePermission',
'writeFileDescriptor', '');
DBMS_JAVA.grant_permission ('Orion', 'SYS:java.lang.RuntimePermission',
'readFileDescriptor', '');
END;
錯誤是無效的對象。
由於
感謝您的回答。因此,我需要通過DBA設置特權,才能爲我工作。謝謝 – CRL88
我目前得到這個錯誤: 8:22:50執行失敗:ORA-29532:Java調用被未捕獲的Java終止異常:java.lang.SecurityException:策略表更新java.io.FilePermission,TestHostCommand – CRL88