Home » Developer & Programmer » JDeveloper, Java & XML » java.security.AccessControlException - the Permission has not been granted (Oracle 10G)
java.security.AccessControlException - the Permission has not been granted [message #343792] Thu, 28 August 2008 03:17
carasegers
Messages: 1
Registered: August 2008
Junior Member
Hi

Please help, I am getting the following error and have tried what has been suggested, but it doesn't work.


java.security.AccessControlException: the Permission (java.net.SocketPermission ....... connect,resolve) has not been granted to ......

The PS/SQL to grant this is dbms_java.grantPermission(.....).


Code is as follows:

Java Code:

create or replace and compile java source named getdriver as
import java.sql.*;
import oracle.jdbc.driver.*;

class JDBCVersion
{
public JDBCVersion()
{


}

public static void main (String args[])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver
(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@199.199.199.9:1521:tusz2","adaptit","adaptit");

// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData();

// gets driver info:
System.out.println("JDBC driver version is " + meta.getDriverVersion());
}
}



Wrapper:
create or replace package cara_getdriver_pack is

PROCEDURE cara_get_driver (endResult IN OUT VARCHAR2);

end cara_getdriver_pack;

create or replace package body cara_getdriver_pack as
PROCEDURE cara_get_driver(endResult IN OUT VARCHAR2)
AS
language java
name 'JDBCVersion.main(java.lang.String[])';

end cara_getdriver_pack;

Procedure to call wrapper:
CREATE OR REPLACE PROCEDURE cara_output_getdriver
AS
v_endresult varchar2(200);
begin
cara_getdriver_pack.cara_get_driver(v_endresult);
dbms_output.put_line('driver is: '||v_endresult);
END cara_output_getdriver;

Actual call:begin
dbms_java.grant_permission('ADAPTIT','SYS:java.net.SocketPermission','199.199.199.9','resolve');
cara_output_getdriver;
end;
Previous Topic: inserting data finto table from a clob column
Next Topic: PLS-00307: too many declarations of 'INSERTXML' match this call
Goto Forum:
  


Current Time: Wed Oct 22 19:57:56 CDT 2014

Total time taken to generate the page: 0.08679 seconds