<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MacLochlainns Weblog &#187; XDB Server</title>
	<atom:link href="http://blog.mclaughlinsoftware.com/category/xdb-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mclaughlinsoftware.com</link>
	<description>Michael McLaughlin's Technical Blog</description>
	<lastBuildDate>Mon, 06 Sep 2010 21:21:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Oracle 11g XDB Shake &amp; Bake</title>
		<link>http://blog.mclaughlinsoftware.com/2009/12/02/oracle-11g-xdb-shake-bake/</link>
		<comments>http://blog.mclaughlinsoftware.com/2009/12/02/oracle-11g-xdb-shake-bake/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 09:54:12 +0000</pubDate>
		<dc:creator>maclochlainn</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle XE]]></category>
		<category><![CDATA[XDB Server]]></category>
		<category><![CDATA[pl/sql]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?p=3243</guid>
		<description><![CDATA[It&#8217;s a bit awkward when a post generates a new question, but here&#8217;s a quick explanation and example of using XDB (XML Database Server) outside of the realm of APEX. More or less, XDB is an Apache Server equivalent configured inside the database. It&#8217;s really a protocol server tied into the Shared Server Oracle*Net Architecture [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a bit awkward when a post generates a new question, but here&#8217;s a quick explanation and example of using XDB (XML Database Server) outside of the realm of APEX. More or less, XDB is an Apache Server <em>equivalent</em> configured inside the database. It&#8217;s really a protocol server tied into the Shared Server Oracle*Net Architecture (a correction provided by <a href="http://www.liberidu.com/blog/?p=1759">Marco Gralike</a>). As a note, testing was done by using a NAT static IP addressing for the virtual Windows XP, Vista, and 7 environments. </p>
<p>This blog post will show you how to experiment with the PL/SQL Web Toolkit and build both password protected and unprotected database content. It assumes you have access to the <code>SYS</code> privileged account.</p>
<p><span style="font-size:125%;font-weight:bold">Setting Up a Secure DAD</span></p>
<p>There&#8217;s secure and then there&#8217;s secure. This falls in the less than secure category but it does provide a password and uses basic HTTP authentication. The <code>USER</code> is the schema name, and the <code>PASSWORD</code> is the same as that for the SQL*Plus access to the schema.</p>
<ol start="1">
<li>Connect as the privileged <code>SYS</code> user and run the following script. It creates a generic <code>STUDENT</code> user and grants minimalist privileges, then it creates a DAD (Data Access Descriptor), and authorizes the DAD. Don&#8217;t run the command if you&#8217;re actively using Oracle APEX on the default configuration of port 8080. It&#8217;s there for those folks you are running Tomcat on 8080.</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- This resets the default port so that it doesn't conflict with other environment.</span>
EXECUTE dbms_xdb<span style="color: #66cc66;">.</span>SETHTTPPORT<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">8181</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">-- This creates the STUDENT Data Access Descriptor.</span>
EXECUTE dbms_epg<span style="color: #66cc66;">.</span>create_dad<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'STUDENT_DAD'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'/sampledb/*'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">-- This authorizes the STUDENT_DAD</span>
EXECUTE dbms_epg<span style="color: #66cc66;">.</span>authorize_dad<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'STUDENT_DAD'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'STUDENT'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

</div>
<ol start="2">
<li>Connect as the <code>STUDENT</code> user and run the following script to create a PL/SQL Web Toolkit procedure.</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> PROCEDURE HelloWorld <span style="color: #993333; font-weight: bold;">AS</span>
BEGIN
  <span style="color: #808080; font-style: italic;">-- Set an HTML meta tag and render page.</span>
  owa_util<span style="color: #66cc66;">.</span>mime_header<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'text/html'</span><span style="color: #66cc66;">&#41;</span>;  <span style="color: #808080; font-style: italic;">-- &lt;META Content-type:text/html&gt;</span>
  htp<span style="color: #66cc66;">.</span>htmlopen;                       <span style="color: #808080; font-style: italic;">-- &lt;HTML&gt;</span>
  htp<span style="color: #66cc66;">.</span>headopen;                       <span style="color: #808080; font-style: italic;">-- &lt;HEAD&gt;</span>
  htp<span style="color: #66cc66;">.</span>htitle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Hello World!'</span><span style="color: #66cc66;">&#41;</span>;         <span style="color: #808080; font-style: italic;">-- &lt;TITLE&gt;HelloWorld!&lt;/TITLE&gt;</span>
  htp<span style="color: #66cc66;">.</span>headclose;                      <span style="color: #808080; font-style: italic;">-- &lt;/HEAD&gt;</span>
  htp<span style="color: #66cc66;">.</span>bodyopen;                       <span style="color: #808080; font-style: italic;">-- &lt;BODY&gt;</span>
  htp<span style="color: #66cc66;">.</span>line;                           <span style="color: #808080; font-style: italic;">-- &lt;HR&gt;</span>
  htp<span style="color: #66cc66;">.</span>print<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Hello ['</span><span style="color: #66cc66;">||</span>user<span style="color: #66cc66;">||</span><span style="color: #ff0000;">']!'</span><span style="color: #66cc66;">&#41;</span>;   <span style="color: #808080; font-style: italic;">-- Hello [dynamic user_name]!</span>
  htp<span style="color: #66cc66;">.</span>line;                           <span style="color: #808080; font-style: italic;">-- &lt;HR&gt;</span>
  htp<span style="color: #66cc66;">.</span>bodyclose;                      <span style="color: #808080; font-style: italic;">-- &lt;/BODY&gt;</span>
  htp<span style="color: #66cc66;">.</span>htmlclose;                      <span style="color: #808080; font-style: italic;">-- &lt;/HTML&gt;</span>
END HelloWorld;
<span style="color: #66cc66;">/</span></pre></td></tr></table></div>

</div>
<ol start="3">
<li>Open a browser of your choice, and enter the following URL.</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://localhost:8181/sampledb/helloworld</pre></div></div>

<p>You then see (or should see) the following Basic HTTP Authentication dialog box. Enter the <code>STUDENT</code> user as the <em>User Name</em> and the <em>Password</em> for the database account. Then, click the <em>OK</em> button.</p>
<p><a href="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/12/XDB_BasicHTTPAuthentication.png"><img src="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/12/XDB_BasicHTTPAuthentication.png" alt="XDB_BasicHTTPAuthentication" title="XDB_BasicHTTPAuthentication" style="border:none" width="553" height="169" class="aligncenter size-full wp-image-3247" /></a></p>
<p>Provided you enter the <em>User Name</em> and <em>Password</em> correctly, you should see the following inside the browser&#8217;s display panel. The <code>USER</code> name is a system session scope variable, which will always return the owner of the package because its created as a <em>Definers Rights</em> procedure.</p>
<p><a href="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/12/XDB_ProcedureDisplay.png"><img src="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/12/XDB_ProcedureDisplay.png" alt="XDB_ProcedureDisplay" title="XDB_ProcedureDisplay" style="border:none" width="425" height="180" class="aligncenter size-full wp-image-3248" /></a></p>
<p>You have now successfully configured your Basic HTTP Authentication XDB, which may offer you some possibilities outside of using Oracle APEX.
</p></div>
<p><span style="font-size:125%;font-weight:bold">Setting Up an Unsecured DAD</span></p>
<p>The trick here is building on what you did by eliminating the authentication. You do this by using the <code>ANONYMOUS</code> account, like Oracle&#8217;s APEX does. Well, not quite like it does because APEX provides a very good user authentication model. It allows you to connect to the <code>ANONYMOUS</code> user where you present and validate your credentials.</p>
<p>Since you have to do all the prior steps, these steps are numbered after those above. You start with step #4.</p>
<ol start="4">
<li>Generally, the XML configuration is missing one key node that <em>allows repository anonymous access</em>. The missing node disallows anonymous login. You can run the code below as the <code>SYS</code> privileged user to open that up if its missing. You can check whether or not it&#8217;s missing by running this as the <code>SYS</code> user:</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> @?<span style="color: #66cc66;">/</span>rdbms<span style="color: #66cc66;">/</span>admin<span style="color: #66cc66;">/</span>epgstat<span style="color: #66cc66;">.</span>sql</pre></div></div>

<p>If it returns the following as the last element of the output, you&#8217;ll need to run the PL/SQL block below.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">+-------------------------------------------------------------------+
| ANONYMOUS access to XDB repository:                               |
|  To allow public access to XDB repository without authentication, |
|  ANONYMOUS access to the repository must be allowed.              |
+-------------------------------------------------------------------+
&nbsp;
Allow repository anonymous access?
----------------------------------
false
&nbsp;
1 row selected.</pre></div></div>

<p>When you run this <a href="http://www.oracle-base.com/articles/11g/NativeOracleXmlDbWebServices_11gR1.php">script</a>, make sure you&#8217;re the privileged <code>SYS</code> user. Then, rerun the <code>epgstat.sql</code> script to verify that you&#8217;ve enabled anonymous access to the repository. You may also need to refresh your browser cache before retesting it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SET</span> SERVEROUTPUT <span style="color: #993333; font-weight: bold;">ON</span>
DECLARE
  lv_configxml XMLTYPE;
  lv_value     VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span> :<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'true'</span>; <span style="color: #808080; font-style: italic;">-- (true/false)</span>
BEGIN
  lv_configxml :<span style="color: #66cc66;">=</span> DBMS_XDB<span style="color: #66cc66;">.</span>cfg_get<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #808080; font-style: italic;">-- Check for the element.</span>
  <span style="color: #993333; font-weight: bold;">IF</span> lv_configxml<span style="color: #66cc66;">.</span>existsNode<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span> THEN
    <span style="color: #808080; font-style: italic;">-- Add missing element.</span>
    <span style="color: #993333; font-weight: bold;">SELECT</span> insertChildXML
           <span style="color: #66cc66;">&#40;</span> lv_configxml
           <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'/xdbconfig/sysconfig/protocolconfig/httpconfig'</span>
           <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'allow-repository-anonymous-access'</span>
           <span style="color: #66cc66;">,</span> XMLType<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'&lt;allow-repository-anonymous-access xmlns=&quot;http://xmlns.oracle.com/xdb/xdbconfig.xsd&quot;&gt;'</span>
       	   <span style="color: #66cc66;">||</span> lv_value
       	   <span style="color: #66cc66;">||</span> <span style="color: #ff0000;">'&lt;/allow-repository-anonymous-access&gt;'</span><span style="color: #66cc66;">&#41;</span>
       	   <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'xmlns=&quot;http://xmlns.oracle.com/xdb/xdbconfig.xsd&quot;'</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #993333; font-weight: bold;">INTO</span>   lv_configxml
    <span style="color: #993333; font-weight: bold;">FROM</span>   dual;
&nbsp;
    DBMS_OUTPUT<span style="color: #66cc66;">.</span>put_line<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Element inserted.'</span><span style="color: #66cc66;">&#41;</span>;
  ELSE
    <span style="color: #808080; font-style: italic;">-- Update existing element.</span>
    <span style="color: #993333; font-weight: bold;">SELECT</span> updateXML
           <span style="color: #66cc66;">&#40;</span> DBMS_XDB<span style="color: #66cc66;">.</span>cfg_get<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
           <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access/text()'</span>
           <span style="color: #66cc66;">,</span> lv_value
           <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'xmlns=&quot;http://xmlns.oracle.com/xdb/xdbconfig.xsd&quot;'</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #993333; font-weight: bold;">INTO</span>   lv_configxml
    <span style="color: #993333; font-weight: bold;">FROM</span>   dual;
&nbsp;
    DBMS_OUTPUT<span style="color: #66cc66;">.</span>put_line<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Element updated.'</span><span style="color: #66cc66;">&#41;</span>;
  END <span style="color: #993333; font-weight: bold;">IF</span>;
&nbsp;
  <span style="color: #808080; font-style: italic;">-- Configure the element.</span>
  DBMS_XDB<span style="color: #66cc66;">.</span>cfg_update<span style="color: #66cc66;">&#40;</span>lv_configxml<span style="color: #66cc66;">&#41;</span>;
  DBMS_XDB<span style="color: #66cc66;">.</span>cfg_refresh;
END;
<span style="color: #66cc66;">/</span></pre></td></tr></table></div>

</div>
<ol start="5">
<li>These tasks also require the privileged <code>SYSTEM</code> user account, and you should sign on to that account to run these commands. The first thing you may need to do is unlock the <code>ANONYMOUS</code> account. It is locked by default. After you unlock it, you&#8217;ll need to verify no default password was assigned by unassigning a password. The following two commands accomplish those tasks.</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Unlock the user account.</span>
<span style="color: #993333; font-weight: bold;">ALTER</span> USER anonymous ACCOUNT <span style="color: #993333; font-weight: bold;">UNLOCK</span>;
<span style="color: #808080; font-style: italic;">-- Ensure a password is assigned to the account so you can create a synonym later.</span>
<span style="color: #993333; font-weight: bold;">ALTER</span> USER anonymous <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> ANONYMOUS;</pre></div></div>

</div>
<ol start="6">
<li>These tasks require the privileged <code>SYS</code> user account because you&#8217;re going to create and authorize another DAD.</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- This creates the STUDENT_DB_DAD Data Access Descriptor.</span>
EXECUTE dbms_epg<span style="color: #66cc66;">.</span>create_dad<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'STUDENT_DB_DAD'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'/db/*'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">-- This authorizes the STUDENT_DB_DAD</span>
EXECUTE dbms_epg<span style="color: #66cc66;">.</span>authorize_dad<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'STUDENT_DB_DAD'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'ANONYMOUS'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">-- Open the anonymous account by setting the database-username parameter and value.</span>
EXECUTE dbms_epg<span style="color: #66cc66;">.</span>set_dad_attribute<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'STUDENT_DB_DAD'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'database-username'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'ANONYMOUS'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

</div>
<ol start="7">
<li>Connect as the <code>STUDENT</code> user and grant <code>EXECUTE</code> permissions on the <code>HELLOWORLD</code> procedure to the <code>ANONYMOUS</code> user account. The <code>GRANT</code> allows you to give unrestricted access to the <code>ANONYMOUS</code> account, which in turn provides it to your web audience.</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">GRANT</span> EXECUTE <span style="color: #993333; font-weight: bold;">ON</span> helloworld <span style="color: #993333; font-weight: bold;">TO</span> anonymous;</pre></div></div>

</div>
<ol start="8">
<li>Connect as the <code>ANONYMOUS</code> user and create a local synonym that point to the <code>STUDENT.HELLOWORLD</code> procedure. The <code>SYNONYM</code> provides a program name for the URL statement. It&#8217;s hides the ownership of the actual procedure by supressing the schema name. (You may need to grant <code>CREATE ANY SYNONYM</code> as the <code>SYSTEM</code> user to the <code>ANONYMOUS</code> user.)</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">CREATE</span> SYNONYM helloworld <span style="color: #993333; font-weight: bold;">FOR</span> student<span style="color: #66cc66;">.</span>helloworld;</pre></div></div>

</div>
<div style="padding-left:30px">
After you&#8217;ve created the synonym, you want to remove the password from the <code>ANONYMOUS</code> account. The following syntax lets you do that as the privileged <code>SYSTEM</code> user.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">ALTER</span> USER anonymous <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #993333; font-weight: bold;">NULL</span>;</pre></div></div>

</div>
<ol start="9">
<li>Open a browser of your choice, and enter the following URL, which won&#8217;t require a <em>User Name</em> or <em>Password</em>.</li>
</ol>
<div style="padding-left:30px">

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://localhost:8181/db/helloworld</pre></div></div>

<p>You should see the same browser panel information as that shown by step #3 above, except one thing. The difference is the user name, which should now be <code>ANONYMOUS</code>. The execution occurs with the permissions of the <em>invoker</em>. This means you&#8217;ll see the data you&#8217;re allowed to see by the owning schema.
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.mclaughlinsoftware.com/2009/12/02/oracle-11g-xdb-shake-bake/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Oracle 11g XDB DADs</title>
		<link>http://blog.mclaughlinsoftware.com/2009/12/01/oracle-11g-xdb-dads/</link>
		<comments>http://blog.mclaughlinsoftware.com/2009/12/01/oracle-11g-xdb-dads/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 04:46:23 +0000</pubDate>
		<dc:creator>maclochlainn</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[XDB Server]]></category>
		<category><![CDATA[pl/sql]]></category>

		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?p=3236</guid>
		<description><![CDATA[Somebody asked me why the DBMS_EPG.GET_DAD_LIST is a procedure because you can&#8217;t just simply list the DAD values. I answered that Oracle chose to implement it that way. Then, they asked how they could query it. I suggested they just run the epgstat.sql diagnostic script provided in the $ORACLE_HOME/rdbms directory, which provides those values and [...]]]></description>
			<content:encoded><![CDATA[<p>Somebody asked me why the <code>DBMS_EPG.GET_DAD_LIST</code> is a procedure because you can&#8217;t just simply list the <code>DAD</code> values. I answered that Oracle chose to implement it that way. Then, they asked how they could query it. I suggested they just run the <code>epgstat.sql</code> diagnostic script provided in the <code>$ORACLE_HOME/rdbms</code> directory, which provides those values and much more.</p>
<p>You can run the diagnostic script as the <code>SYS</code> privileged user, or as any user that has been granted the <code>XDBADMIN</code> role, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> @?<span style="color: #66cc66;">/</span>rdbms<span style="color: #66cc66;">/</span>admin<span style="color: #66cc66;">/</span>epgstat<span style="color: #66cc66;">.</span>sql</pre></div></div>

<p>Notwithstanding the diagnostic script, they asked how you could wrap the <code>OUT</code> mode PL/SQL data type in the procedure call, and return the list of values in a SQL query. Because the formal parameter is a PL/SQL data type, this requires two key things. One is a local variable that maps to the <code>DBMS_EPG</code> package collection data type, and a <em><a href="http://blog.mclaughlinsoftware.com/plsql-programming/pipelined-functions-plsql-tables/">pipelined table function</a></em>. Here&#8217;s one way to solve the problem:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> TYPE dad_list <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">TABLE</span> OF VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">/</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> get_dbms_epg_dads
<span style="color: #993333; font-weight: bold;">RETURN</span> dad_list
PIPELINED <span style="color: #993333; font-weight: bold;">IS</span>
  <span style="color: #808080; font-style: italic;">-- Deine a local variable as the OUT mode target of GET_DAD_LIST procedure.</span>
  source DBMS_EPG<span style="color: #66cc66;">.</span>VARCHAR2_TABLE;
  <span style="color: #808080; font-style: italic;">-- Declare a local variable of the SQL collection data type.  </span>
  list DAD_LIST :<span style="color: #66cc66;">=</span> dad_list<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
BEGIN
  <span style="color: #808080; font-style: italic;">-- Call the procedure to populate the source.</span>
  dbms_epg<span style="color: #66cc66;">.</span>get_dad_list<span style="color: #66cc66;">&#40;</span>source<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #808080; font-style: italic;">-- Extend space for all defined DAD values.</span>
  list<span style="color: #66cc66;">.</span>EXTEND<span style="color: #66cc66;">&#40;</span>source<span style="color: #66cc66;">.</span>COUNT<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #808080; font-style: italic;">-- Assign values from PL/SQL collection to SQL collection.</span>
  <span style="color: #993333; font-weight: bold;">FOR</span> i <span style="color: #993333; font-weight: bold;">IN</span> 1<span style="color: #66cc66;">..</span>source<span style="color: #66cc66;">.</span>COUNT LOOP
    list<span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span> :<span style="color: #66cc66;">=</span> source<span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>;
    PIPE ROW<span style="color: #66cc66;">&#40;</span>list<span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
  END LOOP;
  <span style="color: #993333; font-weight: bold;">RETURN</span>;
END get_dbms_epg_dads;
<span style="color: #66cc66;">/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Set SQL*Plus width.</span>
<span style="color: #993333; font-weight: bold;">SET</span> LINESIZE <span style="color: #cc66cc;">79</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Query collection.</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> column_value <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;DAD LIST&quot;</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #993333; font-weight: bold;">TABLE</span><span style="color: #66cc66;">&#40;</span>get_dbms_epg_dads<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>Marco Gralike provided a simpler approach them the Pipelined Table Function <a href="http://www.liberidu.com/blog/?p=1759">here</a>. I&#8217;ve copied the code example below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> u<span style="color: #66cc66;">.</span>dad <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;PL/SQL DAD List&quot;</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   XMLTable<span style="color: #66cc66;">&#40;</span>XMLNAMESPACES <span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'http://xmlns.oracle.com/xdb/xdbconfig.xsd'</span> <span style="color: #66cc66;">&#41;</span>
       <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list/servlet[servlet-language=&quot;PL/SQL&quot;]'</span>
       PASSING DBMS_XDB<span style="color: #66cc66;">.</span>CFG_GET<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
       <span style="color: #993333; font-weight: bold;">COLUMNS</span> DAD VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span>
       PATH <span style="color: #ff0000;">'/servlet/servlet-name/text()'</span><span style="color: #66cc66;">&#41;</span> u;</pre></td></tr></table></div>

<p>Hope this proves handy to somebody else, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mclaughlinsoftware.com/2009/12/01/oracle-11g-xdb-dads/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
