Re: Java Permission error using DBMS_XMLQuery.setXSLT( ) feature of XSU for PL/SQL
Date: 1 Aug 2002 09:17:33 -0700
Message-ID: <92eeeff0.0208010817.7082bf6_at_posting.google.com>
wilson.to_at_umusic.com (Mr T) wrote in message news:<90aabc52.0208010123.38a31fce_at_posting.google.com>...
> Hi,
>
> I'm having problems trying to apply a XSLT stylesheet using
> DBMS_XMLQuery.setXSLT( ) within XSU for PL/SQL. I'm runing Oracle
> 9.2.0.1.0 on Unix. I have a very basic example (see below) that tries
> to change the name of the TAGS generated by DBMS_XMLQuery.getXML using
> a very simple transformation. The error refers to a Java Permission
> problem:
>
> ORA-29532: Java call terminated by uncaught Java exception:
> java.security.AccessControlException: the Permission
> (java.io.FilePermission <?xml version="1.0"?> ... read) has not been
> granted to WSS.
> The PL/SQL to grant this is dbms_java.grant_permission 'WSS',
> 'SYS:java.io.FilePermission', '<?xml version="1.0"?> .., 'read').
>
> Has anyone had problems with this? If not, any simple working
> examples?
>
> Here's the code:
>
> -------------
>
> declare
> queryCtx DBMS_XMLquery.ctxType;
> result CLOB;
> xsltTagConv VARCHAR2(32767);
> begin
>
> -- set the XSLT
> xsltTagConv :=
> '<?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:template match="*">
> <!-- Copy the current node -->
> <xsl:copy>
> <!-- Including any attributes it has and any child nodes -->
> <xsl:apply-templates/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="ROWSET">
> <WIZARDS>
> <xsl:apply-templates/>
> </WIZARDS>
> </xsl:template>
> </xsl:stylesheet>';
>
> -- set up the query context
> queryCtx := DBMS_XMLQuery.newContext('select * employee where
> emp_id = 1');
>
> -- register the stylesheet to be applied
> DBMS_XMLQuery.setXSLT(queryCtx, xsltTagConv);
>
> -- get the result
> result := DBMS_XMLQuery.getXML(queryCtx);
>
> DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query
> handle.
>
> end;
>
> ---------
>
> Any help would be appreciated.
>
> Wilson
Due to the built in security into java, you *Must* grant permission to database user to be able to read,write,delete etc files on Oracle server.
Using SQL*Plus or Server manager login as SYS and,
Connect as sys/password
-- Specify your user or role in first argument
-- Specify your directory in third argument where your xml files
reside
-- Add write,delete (read,write,delete) in fourth arg. if you want the
user to write or delete files in the directory.
SQL> EXECUTE DBMS_JAVA.GRANT_PERMISSION( 'YOUR_USER | YOUR_ROLE', 'SYS:java.io.FilePermission', '/root/oracle/yourdir', 'read'); SQL> EXECUTE DBMS_JAVA.GRANT_PERMISSION( 'YOUR_USER | YOUR_ROLE', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', NULL );SQL> COMMIT; Try again.
HTH
//Rauf Sarwar
Received on Thu Aug 01 2002 - 18:17:33 CEST