DBMS_EPG - The Embedded PL/SQL Gateway in Oracle 10g Database Release 2
Since the introduction of XML DB in Oracle 9i Release 2, the Oracle server has contained an embedded HTTP server in addition to the Apache HTTP server. In Oracle 10g Release 2 this HTTP server can be used as an embedded PL/SQL gateway to run PL/SQL applications via mod_plsql. The administration of Database Access Descriptors (DADs) for the XML DB HTTP server is performed using the DBMS_EPG
package. This article presents a simple example of its use.
First we must ensure that we have access to the SCOTT sample schema and the XDB schema.
CONN sys/password AS SYSDBA -- Create SCOTT schema if you don't currently have it. @$ORACLE_HOME/rdbms/admin/utlsampl.sql ALTER USER scott IDENTIFIED BY tiger ACCOUNT UNLOCK;
Next we use the CREATE_DAD
procedure to create a database access descriptor with an associated virtual path.
BEGIN DBMS_EPG.create_dad ( dad_name => 'my_epg_dad', path => '/my_epg_dad/*'); END; /
The current mappings for a specific DAD can be retrieved using the get_all_dad_mappings
procedure.
SET SERVEROUTPUT ON SIZE UNLIMITED DECLARE l_paths DBMS_EPG.varchar2_table; BEGIN DBMS_EPG.get_all_dad_mappings ( dad_name => 'my_epg_dad', paths => l_paths); DBMS_OUTPUT.put_line('Mappings'); DBMS_OUTPUT.put_line('========'); FOR i IN 1 .. l_paths.count LOOP DBMS_OUTPUT.put_line(l_paths(i)); END LOOP; END; / Mappings ======== /my_epg_dad/* PL/SQL procedure successfully completed. SQL>
The mappings associated with existing DADs can be altered using the UNMAP_DAD
and MAP_DAD
procedures.