Home > Default > Permission problem calling a java object from a store procedure

Permission problem calling a java object from a store procedure

October 11Hits:1
Advertisement
When I run my store procedure
CREATE OR REPLACE PACKAGE BODY confirms_write_to_file
AS
FUNCTION translate(in_en_var in VARCHAR2)
RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'translate.translatePath(java.lang.String) return java.lang.String';
PROCEDURE write_to_file(in_file_name IN VARCHAR, in_en_var IN VARCHAR)
IS
file_handle               UTL_FILE.FILE_TYPE;
file_location VARCHAR2(50);
BEGIN
file_location := translate(in_en_var);
dbms_output.put_line ('opened file location' ||file_location);
END write_to_file;
END confirms_write_to_file;
I get the following error:
exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
SQL> exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
Exception java.security.AccessControlException: the Permission
(java.io.FilePermission <<ALL FILES>> execute) has not been granted by
dbms_java.grant_permission to
SchemaProtectionDomain(RIMS|PolicyTableProxy(RIMS))
opened file locationProcess problem
PL/SQL procedure successfully completed.
When I try to to grant myself the permissions
begin
dbms_java.grant_permission('rims','java.io.FilePermission','*','execute');
dbms_java.grant_permission('rims', 'java.lang.RuntimePermission', '*','writeFileDescriptor' );
end;
I get the following Error:
oracle.aurora.vm.IdNotFoundException: rims is not a user or role
at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
at
oracle.aurora.rdbms.security.PolicyTableManager.findAll(PolicyTableManager.java)
at oracle.aurora.rdbms.security.PolicyTableManager.find(PolicyTableManager.java)
at
oracle.aurora.rdbms.security.PolicyTableManager.activate(PolicyTableManager.java
at
oracle.aurora.rdbms.security.PolicyTableManager.grant(PolicyTableManager.java)
begin
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.aurora.vm.IdNotFoundException: rims is not a user or role
ORA-06512: at "SYS.DBMS_JAVA", line 0
ORA-06512: at line 2
My java code is as follows
import java.io.*;
import java.util.*;
class translate
     public static String translatePath(String envar)
          Runtime rt = Runtime.getRuntime();
          int bufSize = 4096;
          byte buffer[] = new byte[bufSize];
          String path = null;
          Process p = null;
          int len = 0;
          try
               p = rt.exec("echo "+envar);
               BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
               while ((len = bis.read(buffer, 0, bufSize)) != -1)
                    System.out.write(buffer, 0, len);
               path = new String(buffer);
               p.waitFor();
          catch(Exception e)
               System.out.println("Exception "+e);
               return "Process problem ";
          return path;

Answers

Tony,
I answered this very same question that you posted at the JavaRanch forum.
Good Luck,
Avi.

Read other 2 answers

Tags:

Related Articles

  • Permission problem calling a java object from a store procedureOctober 11

    When I run my store procedure CREATE OR REPLACE PACKAGE BODY confirms_write_to_file AS FUNCTION translate(in_en_var in VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'translate.translatePath(java.lang.String) return java.lang.String'; PROCEDURE writ

  • Calling a java object from a store procedureNovember 30

    I have written a translation object in java that takes a $en_var in and returns its path. What I need to do is call that object from a PL/SQL store procedure. All the examples I have seen treat the store procedure as a wrapper around the java object.

  • Problem when adding java objects in a vector and passing thru web serviceNovember 30

    Hi! I'm getting this error when I try to add a java object I created into a vector and passing it through a web service: java.lang.IllegalArgumentException: No Serializer found to serialize a 'testObj' using encoding style 'http://schemas.xmlsoap.org

  • Empty strings when passing a Java object to a Stored ProcedureOctober 11

    Hi, I'm using the interface SQLData to pass Java objects to StoredProcedures. All the object's attributes 'arrive' to the Stored Procedure ok, except the strings, which are empty. Here is my Oracle object: TYPE OBJ_ASJFF_OBJ1 IS OBJECT ( ARG1 CHAR(3)

  • Problem with XMLEncoder for complex java object iOctober 11

    Hi All. My problem with XMLEncoder is it doesnt transfrom java objects without default no arguement constructor. I was able to resolve this in my main java object class, by setting a new persistence delegate, but for other classes that are contained

  • "How to Resolve ORA-29532 Java 2 Permission Problems in RDBMS 8.1.6 and 8.1.7"November 30

    I'm in the process of publishing the following note (134280.1), titled "How to Resolve ORA-29532 Java 2 Permission Problems in RDBMS 8.1.6 and 8.1.7". It will be accessible from Oracle Support's "Metalink" site. "How to Resolve OR

  • Problems after creating report objectOctober 11

    I am using Crystal Reports Server XI R2 SP4. I created a report object from a simple Crystal report successfully. Even the thumbnail showed the report data even though the report does not save data. However when I view the report object in InfoView o

  • How can I use XStream to persist complicated Java Object  to XML & backwardOctober 11

    Dear Sir: I met a problem as demo in my code below when i use XTream to persist my Java Object; How can I use XStream to persist complicated Java Object to XML & backward?? See [1] main code import java.io.BufferedReader; import java.io.BufferedWrite

  • How to insert a java object int derby databaseOctober 11

    hi, i have a problem , ie..i want to insert my java object int database derby.and also i need to retrieve that object from database whenever i need. Any body help me to do that in derby... ThanksOr you would design a table where the columns of the ta

  • Reg XML generation from java objects using SAX 2.0October 11

    i'm using java 1.6 and i've imported following class to generate XML from java objects import com.sun.org.apache.xml.internal.serialize.OutputFormat; import com.sun.org.apache.xml.internal.serialize.XMLSerializer; the following class has been imple h

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.756 s.