Dbms_java.grant_permission not working

Hi,
Actually using code from Asktom,i have written java program which is getting list of file and inserting them in database table but then i need to give rights using
execute dbms_java.grant_permission( 'PDMAIN', 'SYS:java.io.FilePermission', '\\lu1dpc21\cdrv','read');
But problem when i am executing it in procedure its not working ,i need to execute it from sql*plus,so is it limitation or i am not doing anything wrong.
Regards,
Sandeep

And your Oracle version is? Please paste your output of the below steps -
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
Connected as hr
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL> CALL DBMS_JAVA.SET_OUTPUT(1000000);
Method called
SQL> call dbms_java.grant_permission('HR', 'java.io.FilePermission', '/tmp', 'read,write');
Method called
SQL> begin
2 dbms_java.grant_permission('HR', 'java.io.FilePermission', '/tmp', 'read,write');
3 end;
4 /
PL/SQL procedure successfully completed
SQL> select type_name from user_java_policy where name = '/tmp' ;
TYPE_NAME
java.io.FilePermission
Best regards.

Similar Messages

  • Trace File / EJB / dbms_java.grant_permission

    I am trying to deploy a simple Hello World EJB onto Oracle 8.1.7 using Jdeveloper 3.2.
    I get the following error when deploying :
    Loading EJB Jar file and Comm Stubs Jar file...
    error: loadJava has failed to load some classes; Please check trace file!
    *** Errors occurred while deploying the EJB to 8i JVM ***
    *** Deployment completed ***
    My trace file has the following in it :
    *** 2001-05-03 17:33:29.531
    *** SESSION ID:(14.2397) 2001-05-03 17:33:29.531
    Error while creating class oracle/aurora/jndi/sess_iiop/ActivationException
    ORA-29545: badly formed class: User has attempted to load a class (oracle.aurora.jndi.sess_iiop.ActivationException) into a restricted package. Permission can be granted using dbms_java.grant_permission(<user>, LoadClassInPackage...
    could not find oracle/aurora/jndi/sess_iiop/ActivationException in WILLOW2K
    could not find oracle/aurora/jndi/sess_iiop/ActivationException in WILLOW2K
    ORA-29534: referenced object WILLOW2K.javax/naming/InitialContext could not be resolved
    ORA-29545: badly formed class: at offset 128 of packagessb.ssbClient2.main expecting a class-javax.naming.NamingException but encountered a class-oracle.aurora.jndi.sess_iiop.ActivationException.
    ORA-29545: badly formed class: at offset 4 of javax.naming.spi.NamingManager.createObjectFromFactories expecting a class-javax.naming.Context but encountered a class-javax.naming.Context.
    at offset 4 of javax.naming.spi.NamingManager.getStateToBind expecting a class-javax.naming.Context but encountered a class-javax.naming.Context.
    at offset 38 of javax.naming.spi.NamingManager.getStateToBind expecting a class-javax.naming.Context but encountered a class-javax.naming.Context.
    at offset 38 of javax.naming.spi.NamingManager.getStateToBind expecting a class-javax.naming.Name but encountered a class-javax.naming.Name.
    at offset 37 of javax.naming.spi.NamingManager.getURLObject expecting a class-javax.naming.Context but encountered a class-javax.naming.Context.
    ORA-29534: referenced object WILLOW2K.javax/naming/spi/NamingManager could not be resolved
    ORA-29534: referenced object WILLOW2K.javax/naming/spi/NamingManager could not be resolved
    Error while resolving class oracle/aurora/jndi/sess_iiop/ActivationException
    ORA-04043: object /889d46b7_ActivationException does not exist
    I think the error stems from the line :
    (oracle.aurora.jndi.sess_iiop.ActivationException) into a restricted package. Permission can be granted using dbms_java.grant_permission(<user>, LoadClassInPackage...
    Doe anyone know how I can grant the user permission to the above library. How exactly is it done using Oracle 8.1.7 ?
    null

    did you read the install notes (install.htm) or release notes(readme.htm) files for known issues ?
    see the release notes for the following :
    Problems Deploying Business Components for Java Libraries in Different Schema (1095107)
    Attempting to deploy a Business Components for Java library in a different schema from the JDeveloper IDE generates the following error:
    Generating Jar File...done
    Loading EJB Jar file and Comm Stubs Jar file...
    error: loadJava has failed to load some classes; Please check trace file!
    *** Errors occurred while deploying the EJB to 8i JVM ***

  • DBMS_JAVA.GRANT_PERMISSION RESULTS IN ORA-03113

    I've successfully created and deployed a java procedure that compresses files for use as email attachements. Upon executing the procedure I get a trace file telling me to grant java.io.FilePermission to the user. I attempted the call (connected as sys (sysdba)):
    exec dbms_java.grant_permission('VEHICLE','SYS:java.io.FilePermission','f:\oracle\soe_data\*', 'read, write');
    which resulted in:
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    and a core dump with:
    ORA-07445: exception encountered: core dump [ACCESS_VIOLATION] [unable_to_trans_pc] [PC:0x377E21D] [ADDR:0x24] [UNABLE_TO_READ] []
    I opened up an SR on metalink and have not gotten a response.
    I checked the Java install with "desc DBMS_JAVA" and got no errors. I also tried several variations to the path syntax, escaping the backslash, with/without the *, to just the directory, to an explicit filename, etc.
    Oracle information is as follows:
    Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Windows XP Version V5.1 Service Pack 2
    CPU : 1 - type 586
    Thanks in advance

    I finally got this resolved. Apparently the catpatch.sql script did not run during the last upgrade causing a version mis-match

  • Consuming Web Services in 11.2 does not work (UTL_DBWS)

    Hello
    i read some documents for consuming web services on the internet , but i get an error when i call add_numbers function as follows:
    i connected on WSUSER , then
    SQL> select add_numbers(1,3) from dual;
    The Error message is:
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.IllegalAccessException: java.lang.ExceptionInInitializerError
    ORA-06512: at "WSUSER.UTL_DBWS", line 193
    ORA-06512: at "WSUSER.UTL_DBWS", line 190
    ORA-06512: at "WSUSER.ADD_NUMBERS", line 25"
    I use the following steps to setup the UTL_DBWS :
    1-     Create new user 'WSUSER'
    2-     Run the UTL_DBWS scripts ( utl_dbws_decl.sql , utl_dbws_body.sql) on WSUSER.
    3-     Execute this command
    loadjava -u scott/tiger -r -v -f -genmissing dbwsclientws.jar dbwsclientdb11.jar
    4-     Log in as sys and grant these privileges to our new user:
    execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxySet','write');
    execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxyHost', 'write');
    execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxyPort', 'write');
    execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission', 'accessClassInPackage.sun.util.calendar','');
    execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission','getClassLoader','');
    execute dbms_java.grant_permission('WSUSER','SYS:java.net.SocketPermission','*','connect,resolve');
    execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','*','read,write');
    execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission','setFactory','');
    execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission', 'createClassLoader', '' )
    5-     Create add_numbers function on wsuser to test utl_dbws:
    CREATE OR REPLACE FUNCTION add_numbers (p_int_1 IN NUMBER,
    p_int_2 IN NUMBER)
    RETURN NUMBER
    AS
    l_service UTL_DBWS.service;
    l_call UTL_DBWS.call;
    l_wsdl_url VARCHAR2(32767);
    l_namespace VARCHAR2(32767);
    l_service_qname UTL_DBWS.qname;
    l_port_qname UTL_DBWS.qname;
    l_operation_qname UTL_DBWS.qname;
    l_xmltype_in SYS.XMLTYPE;
    l_xmltype_out SYS.XMLTYPE;
    l_return NUMBER;
    BEGIN
    l_wsdl_url := 'http://www.oracle-base.com/webservices/server.php?wsdl';
    l_namespace := 'http://www.oracle-base.com/webservices/';
    l_service_qname := UTL_DBWS.to_qname(l_namespace, 'Calculator');
    l_port_qname := UTL_DBWS.to_qname(l_namespace, 'CalculatorPort');
    l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'ws_add');
    l_service := UTL_DBWS.create_service (
    wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
    service_name => l_service_qname);
    l_call := UTL_DBWS.create_call (
    service_handle => l_service,
    port_name => l_port_qname,
    operation_name => l_operation_qname);
    l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
    <ws_add xmlns="' || l_namespace || '">
    <int1>' || p_int_1 || '</int1>
    <int2>' || p_int_2 || '</int2>
    </ws_add>');
    l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
    request => l_xmltype_in);
    UTL_DBWS.release_call (call_handle => l_call);
    UTL_DBWS.release_service (service_handle => l_service);
    l_return := l_xmltype_out.extract('//return/text()').getNumberVal();
    RETURN l_return;
    END;
    6-     Test the function
    Select add_numbers(1,2) from dual
    on the test i get the error message :
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.IllegalAccessException: java.lang.ExceptionInInitializerError
    ORA-06512: at "WSUSER.UTL_DBWS", line 193
    ORA-06512: at "WSUSER.UTL_DBWS", line 190
    ORA-06512: at "WSUSER.ADD_NUMBERS", line 25
    anyone have an idea to resolve this error .
    thanks alot

    Hi.
    Looking at the code, it seems it is my article you are asking about.
    http://www.oracle-base.com/articles/10g/utl_dbws10g.php
    I've just run through it on an 11.2 instance and it works fine for me.
    Make sure your server has access to the Internet and make sure the java classes are loaded successfully.
    Cheers
    Tim...

  • Dbms_java.grant_permission fails during the subsequent executions

    Always first call succeeds for the following lines in a procedure.
    dbms_java.grant_permission('MDSYS','SYS:java.io.FilePermission','D:\temp\test.dat,'read' );
    dbms_java.grant_permission('SCOTT,'SYS:java.io.FilePermission','D:\temp\test.dat,'read' );
    Any subsequent call does not return error message. But the other parts of the code fails to recognize the file permission and results in error.
    Workaround is to run the grant_permission for a set for files separately, then the other parts of the code recognize the file permissions.
    Any ideas? Thanks.

    Thanks for your attention.
    1. Here is the code
    -- Import the image.
    PROCEDURE Import_Raster (pi_grant_schema varchar2, pi_utldirname varchar2, pi_filename varchar2, pi_georid number)
    IS
         -- PRAGMA AUTONOMOUS_TRANSACTION;
         geor SDO_GEORASTER;
         l_filepathname varchar2(255);
         l_privilege varchar2(50) := 'read';
    BEGIN
         l_filepathname:= pi_utldirname||'\'||pi_filename;
         dbms_java.grant_permission('MDSYS','SYS:java.io.FilePermission',l_filepathname, l_privilege );
         dbms_java.grant_permission(pi_grant_schema,'SYS:java.io.FilePermission',l_filepathname, l_privilege );
         delete from georaster_table where georid = pi_georid;
         insert into georaster_table (georid,georaster)
              values( pi_georid, sdo_geor.init('RDT_GEOR', pi_georid) );
         select georaster into geor from georaster_table where georid = pi_georid for update;
         sdo_geor.importFrom(geor, '', 'TIFF', 'file',l_filepathname);
         update georaster_table set georaster = geor where georid = pi_georid;
         dbms_java.revoke_permission('MDSYS','SYS:java.io.FilePermission',l_filepathname, l_privilege );
         dbms_java.revoke_permission(pi_grant_schema,'SYS:java.io.FilePermission',l_filepathname, l_privilege );
    END;
    2. I could reproduce the error if repeated call the procedure with different file name as below.
    call dbms_java.grant_permission('SCOTT','SYS:java.io.FilePermission','e:\temp\m25l_2_a.tif','read' );
    call dbms_java.grant_permission('SCOTT','SYS:java.io.FilePermission','e:\temp\m25l_2_b.tif','read' );
    call dbms_java.grant_permission('SCOTT','SYS:java.io.FilePermission','e:\temp\m26d_2.tif','read' );
    call dbms_java.grant_permission('SCOTT','SYS:java.io.FilePermission','e:\temp\m26e_2.tif','read' );
    call dbms_java.grant_permission('SCOTT','SYS:java.io.FilePermission','e:\temp\m26f_3.tif','read' );
    call dbms_java.grant_permission('SCOTT','SYS:java.io.FilePermission','e:\temp\m26g_1.tif','read' );
    3. Workaround: I am exiting the session after each command.
    Thanks.

  • "dbms_java.grant_permission" procedure

    Dear sir,
    i am using standalone oc4j and my url come like 'http://localhost:8888/mapviewer/
    in my machine where i am running the mapviewer. but my oracle database is on another machine and i am following two procedures to grant permissions
    call dbms_java.grant_permission('CPU','SYS:java.net.SocketPermission','http://localhost:8888
    ','resolve');
    call dbms_java.grant_permission('MDSYS','SYS:java.net.SocketPermission','http://localhost:8888
    ','resolve');
    but when i am trying to do this following query from CPU user
    giving following error
    SQL> select sdo_mvclient.getdatasources() datasources from dual;
    select sdo_mvclient.getdatasources() datasources from dual
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.NullPointerException
    please any one tell me how can i solve this problem
    Thanks
    Kabeer

    Hi Kabeer,
    This is not permission issue problem, because you receive NULL pointer exception. If, database user doesn't have access to the network java.security.AccessControlException is thrown.
    I think, that you have not executed:
    call sdo_mvclient.createmapviewerclient(
    'http://www.mycorp.com:8888/mapviewer/omserver') ;
    in the database session, before using PL/SQL MapViewer API. And, if you really have not executed this, then you will receive null pointer exception, because there is no information about remote MapViewer service in the database session.
    You should follow the steps described in Section 6.2 of MapViewer 11EA1 User Guide. 6.2.1 - network access, 6.2.2 - MapViewer handle declaration (session scope).
    I have deployed mvclient.jar and successfully using remote MapViewer service. Database and Mapviewer are on the different machines and network.
    So, I think your problem is, that you have not declared address of remote MapViewer server in the session. According to documentation it should be declared for each session.
    Regards,
    Andrejus

  • Dbms_java.grant_permission() help

    Hi,
    As system I have execute the dbms_java.grant_permission('SCOTT','java.io.FilePermission','/tmp/ls.txt','read,write,execute') which went through fine.
    In the java procedure I am trying to access the /tmp/ls.txt file. When I execute the procedure I am getting the following error.
    java.security.AccessControlException: the Permission (java.io.FilePermission
    <<ALL FILES>> execute) has not been granted by dbms_java.grant_permission to
    SchemaProtectionDomain(SCOTT|PolicyTableProxy(SCOTT))
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java)
    at java.security.AccessController.checkPermission(AccessController.java)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java)
    at
    oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(SecurityManagerImpl.java
    at java.lang.SecurityManager.checkExec(SecurityManager.java)
    at java.lang.Runtime.exec(Runtime.java)
    at java.lang.Runtime.exec(Runtime.java)
    at java.lang.Runtime.exec(Runtime.java)
    at lastGenTrigger.afterUpdate(lastGenTrigger.java:21)
    Any help ???
    Thanx in advance
    Guru

    Ensure user scott has reconnected to the database after the permission has been granted.
    null

  • How to use dbms_java.grant_permission

    i am trying to execute the following statements in oracle9i, i got an error
    SQL> call dbms_java.grant_permission('scott','java.io.FilePermission',
    2 'C:\framework\Shell Scripts\testscripts\*',
    3 'execute');
    call dbms_java.grant_permission('scott','java.io.FilePermission',
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.aurora.vm.IdNotFoundException: scott is not a user or role

    Are you granting this from sys user? does 'scott' schema really exists in your database?

  • Dbms_java.grant_permission in Microsoft Windows

    Hi,
    I have tried so many many times to get this working but have failed. When I ran the following statement, it did return 10 rows (10 files in the path in operating system). However, all rows showed null values with no data at all. I think this is something to deal with Windows. I cannot find any help on the Web. Here is the package that I got:
    http://sql-plsql-de.blogspot.com/2008/09/ein-einfacher-ansatz-dateien-eines.html?lang=en
    <pre>
    begin
    dbms_java.grant_permission(
    'XXX_MGR',
    'SYS:java.io.FilePermission',
    'F:\xxx_jobs\uploads\images\birth',
    'read');
    end;
    select e.file_name, e.is_dir, e.file_size
    from table(file_pkg.get_file_list(file_pkg.get_file('F:\xxx_jobs\uploads\images\birth'))) e
    </pre>

    grant read permission to the directory and the files in it by using F:\xxx_jobs\uploads\images\birth\-. F:\xxx_jobs\uploads\images\birth\* is also an alternative.thanks to Carsten Czarski page for highlighting this.

  • List permissions when granted by dbms_java.grant_permission

    Is there a way to find out all the granted permissions which were assigned by the dbms_java.grant_permission() method?
    thanks,
    James.

    If I recall they are in DBA_JAVA_POLICY etc. but I'm not 100% sure.

  • Not work tablet UI on Prestigio 5080 PRO tablet

    I read that browser.ui.layout.tablet = "1" can fix this problem. But it not works. I can work only in pnone interface that is not good for my 8'' tablet.

    Would it be possible for you to share the problematic pdf and OS information  with us at [email protected] so that we may investigate?
    Thanks,
    Adobe Reader Team

  • Why self-defined access sequences of free goods can not work?

    Hi gurus,
    I have maintained access sequences of free goods self-defined.but when i creat the SO it does not work!
    when i used the standard access sequences ,it is OK .
    Can anybody tell me why?
    thanks in advance

    Dear Sandy,
    Go to V/N1 transaction select your self defined access sequence then go in to the accesses and fields and check all fields are activated.
    Make sure that these fields are flowing in your sales order.
    I hope this will help you,
    Regards,
    Murali.

  • Adobe bridge raw not working with windows vista in photoshop cc, why?

    adobe bridge raw not working in photoshop cc, is there a fix?

    Your sure your using photoshop cc on windows vista?
    I was under the impression that photoshop cc would not even install on windows vista.
    What version of camera raw do you have?
    In photoshop under Help>About Plugin does it list Camera Raw and if so which version is it?
    (click on the words Camera Raw to see the version)
    Camera raw doesn't work if it's a camera raw file or some other file type such as jpeg or tif?
    What camera are the camera raw files from?
    Officially camera raw 8.3 is the latest version of camera raw that will work on windows vista.

  • Adobe Bridge CS5 in windows 7 not working?

    Adobe Bridge CS5 in windows 7 not working. I was using bridge perfectly for last 2 years. It stops working since 3 days. I tried to install updates. Showing some error to install.
    Tried to install creative cloud..again some error. Error code : 82
    Could you please advice how I can fix my adobe bridge.

    https://www.youtube.com/watch?v=xDYpTOoV81Q&feature=youtu.be
    please check this video I uploaded..this is what happens when I click adobe bridge.. just blinks and go off. bridge not working on task manager

  • ADOBE CLOUD ON MY DESKTOP WILL NOT WORK. IT LOADS UP BUT NOTHING FILLS THE WINDOW

    ADOBE CLOUD ON MY DESKTOP WILL NOT WORK. IT LOADS UP BUT NOTHING FILLS THE WINDOW

    BLANK Cloud Screen http://forums.adobe.com/message/5484303 may help
    -and step by step http://forums.adobe.com/thread/1440508?tstart=0
    -and http://helpx.adobe.com/creative-cloud/kb/blank-white-screen-ccp.html

Maybe you are looking for

  • Supress empty page which is due to dynamic page (smartforms)

    hi all, i' ve got the problem that i get an empty page at the end of my printout. the forms is defined as following: first_page - following page: next_page next_page - following page: next_page and in the main window i have a dynamic page (via comman

  • How do I make a case-insensitive comparison with PHP?

    This is what I have tried so far: if (strcasecmp($var, "ComparedString") == 0) $error = 1; ...but it doesn't seem to work.

  • Finder relaunches when viewing M2V file info ...

    I'm not sure if this is the right forum for this question, but I imagine I'm most likely to find an answer here. So, here it goes: As the topic states, the Finder relaunches itself whenever I try to view the file info of a M2V file. This happens when

  • How to install a SUN cluster in a non-global zone?

    How do I install a SUN cluster in a non-global zone? If it is the same as installing SUN Cluster in the global zone, then how do I access the cdrom from a non-global zone to the global zone? Please point me to some docs or urls if there are any. Than

  • Choose the Subject Area according to the user connexion

    Hi all, Suppose that I have many subject area in the presentation layer (for example SA1 and SA2). Is it possible to choose the subject area to display according to the user connexion. ie. If we have two users User1 and User2 and i would like to scho