DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:dssw2k01:1521:orcl", "scott", "tiger");
CallableStatement cstmt = conn.prepareCall(
"{call sys.dbms_java.grant_permission" +
"('SCOTT','java.net.SocketPermission','dssnt01:1024-','connect,resolve')}");
long rslt = cstmt.executeUpdate();
if (rslt==0)
System.out.println("OK");
cstmt.close();
conn.close();