Hi,
im trying to call java method from oracle procedure but i got the above error,the below is my java code:
DROP JAVA SOURCE AML_CONNECT."DirList";
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED AML_CONNECT."DirList" as import java.io.*;
import java.sql.*;
public class DirList {
public static void getList(String directory)
throws SQLException {
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
String sql = "INSERT INTO DIR_LIST values (?)";
File path = new File(directory);
String[] list = path.list();
String element;
for (int i = 0; i < list.length; i++) {
element = list[i];
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, element);
pstmt.executeUpdate();
pstmt.close();
}
}
}
/
and the below is my procedure:
create or replace PROCEDURE P_CALL_JAVA(P_DIR varchar2)
as language java
name 'DirList.getList(java.lang.String)';
also i coonest as sys to db and execute the below:
begin
dbms_java.grant_permission(
grantee => 'AML_CONNECT',
permission_type=> 'SYS:java.io.FilePermission',
permission_name=> '<<ALL FILES>>',
permission_action=>'execute',
key=>x);
dbms_java.grant_permission('AML_CONNECT',
'java.util.PropertyPermission',
'*',
'read,write');
dbms_java.grant_permission('AML_CONNECT',
'java.io.FilePermission',
'\matt1.gif',
'read');
any help regarding this issue.
commit;
end;