<?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; Java</title>
	<atom:link href="http://blog.mclaughlinsoftware.com/category/java/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>MySQL, XSLT &amp; Xalan Queries</title>
		<link>http://blog.mclaughlinsoftware.com/2010/07/09/mysql-xslt-xalan-queries/</link>
		<comments>http://blog.mclaughlinsoftware.com/2010/07/09/mysql-xslt-xalan-queries/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 04:55:23 +0000</pubDate>
		<dc:creator>maclochlainn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?p=4070</guid>
		<description><![CDATA[I posted how to connect to an Oracle database from an XSLT library file back in August 2008. It&#8217;s an event driven XML approach that can support web page development. One of my students wanted to do the same thing against MySQL. He quickly saw that it was simply a matter of the switching the [...]]]></description>
			<content:encoded><![CDATA[<p>I posted <a href="http://blog.mclaughlinsoftware.com/2008/08/29/querying-oracle-directly-from-xml/">how to connect to an Oracle database from an XSLT library file</a> back in August 2008. It&#8217;s an event driven XML approach that can support web page development. One of my students wanted to do the same thing against MySQL. He quickly saw that it was simply a matter of the switching the JDBC library. He&#8217;s got the whole idea bundled on <a href="http://ubuntujourney.blogspot.com/2010/07/getting-mysql-data-into-xml-easily.html" rel="pingback">his blog here</a>.</p>
<div class="dropdownbox" style="padding-left:20px;background:#FFFFFF">
<p title="Click to see content ..." class="dropdownclick"><strong><em><span style="font-size:125%">XSLT Library File to Query MySQL Database</span></em></strong> <span>&darr;</span></p>
<p style="clear: both">
Unfold this if you&#8217;d like to see the XLST code he&#8217;s posted on his blog for MySQL. You&#8217;ll find that only line #10 (below) required a change. If you&#8217;re new to XSLT, you may find Doug Tidwell&#8217;s <a href="http://www.amazon.com/XSLT-2nd-Doug-Tidwell/dp/0596527217/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1278737275&#038;sr=8-1">XSLT, 2<sup>nd</sup> Edition book</a> very helpful.
</p>
<div>
<div class="panelCode680">

<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
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:stylesheet</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:xsl</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/XSL/Transform&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:sql</span>=<span style="color: #ff0000;">&quot;org.apache.xalan.lib.sql.XConnection&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">extension-element-prefixes</span>=<span style="color: #ff0000;">&quot;sql&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:output</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;html&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:template</span> <span style="color: #000066;">match</span>=<span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:variable</span></span>
<span style="color: #009900;">  <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;movies&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;sql:new('com.mysql.jdbc.Driver','jdbc:mysql:///storedb','student','student')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:variable</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;streaming&quot;</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;sql:disableStreamingMode($movies)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:variable</span></span>
<span style="color: #009900;">  <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;queryResults&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;sql:query($movies,'SELECT i.item_title, i.item_asin, i.item_release_date FROM storedb.item i')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>MySQL Result Set<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/head<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;font-family: sans-serif;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;table</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">cellpadding</span>=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tr<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:for-each</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;$queryResults/sql/metadata/column-header&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;th<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;xsl:value-of</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;@column-label&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/th<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:for-each<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:apply-templates</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;$queryResults/sql/row-set/row&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:value-of</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;sql:close($movies)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:template</span> <span style="color: #000066;">match</span>=<span style="color: #ff0000;">&quot;row&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tr<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;xsl:apply-templates</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;col&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/tr<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:template</span> <span style="color: #000066;">match</span>=<span style="color: #ff0000;">&quot;col&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;td<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;xsl:value-of</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;text()&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/td<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:stylesheet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

</div>
</div>
</div>
<p>Hope this helps those looking for a solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mclaughlinsoftware.com/2010/07/09/mysql-xslt-xalan-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No Java in Oracle XE</title>
		<link>http://blog.mclaughlinsoftware.com/2009/11/26/no-java-in-oracle-xe/</link>
		<comments>http://blog.mclaughlinsoftware.com/2009/11/26/no-java-in-oracle-xe/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 04:34:46 +0000</pubDate>
		<dc:creator>maclochlainn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle XE]]></category>

		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?p=3146</guid>
		<description><![CDATA[While helping in the forum, I noticed that folks don&#8217;t know that Java isn&#8217;t deployed with the Oracle 10g XE. However, it strikes me that you might be able to fudge it but I&#8217;m not sure that&#8217;s allowed in the EULA. If you want Java inside the database, why wouldn&#8217;t you install the licensed product? [...]]]></description>
			<content:encoded><![CDATA[<p>While helping in the forum, I noticed that folks don&#8217;t know that Java isn&#8217;t deployed with the Oracle 10<em>g</em> XE. However, it strikes me that you might be able to fudge it but I&#8217;m not sure that&#8217;s allowed in the EULA. If you want Java inside the database, why wouldn&#8217;t you install the licensed product?</p>
<p>There was an OTN article that listed three limitations but this wasn&#8217;t one in the article. Maybe I&#8217;ll run across the marketing note sometime in the furture or somebody will post the URL as a comment, which is always appreciated.</p>
<p>Anyway, the presence or lack of Java inside the database is pretty easy to test. You only need to do this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">*</span>Plus: Release 10<span style="color: #66cc66;">.</span>2<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>1<span style="color: #66cc66;">.</span>0 <span style="color: #66cc66;">-</span> Production <span style="color: #993333; font-weight: bold;">ON</span> Thu Nov <span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">21</span>:<span style="color: #cc66cc;">19</span>:<span style="color: #cc66cc;">42</span> <span style="color: #cc66cc;">2009</span>
Copyright <span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span> <span style="color: #cc66cc;">1982</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2005</span><span style="color: #66cc66;">,</span> Oracle<span style="color: #66cc66;">.</span>  <span style="color: #993333; font-weight: bold;">ALL</span> rights reserved<span style="color: #66cc66;">.</span>
&nbsp;
Connected <span style="color: #993333; font-weight: bold;">TO</span>:
Oracle <span style="color: #993333; font-weight: bold;">DATABASE</span> 10g Express Edition Release 10<span style="color: #66cc66;">.</span>2<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>1<span style="color: #66cc66;">.</span>0 <span style="color: #66cc66;">-</span> Production
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> <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;">AND</span> RESOLVE JAVA SOURCE NAMED HelloWorldSQL <span style="color: #993333; font-weight: bold;">AS</span>
  <span style="color: #cc66cc;">2</span>  public class HelloWorldSQL <span style="color: #66cc66;">&#123;</span>
  <span style="color: #cc66cc;">3</span>    public static String hello<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #cc66cc;">4</span>      <span style="color: #993333; font-weight: bold;">RETURN</span> <span style="color: #ff0000;">&quot;Hello World.&quot;</span>; <span style="color: #66cc66;">&#125;</span>
  <span style="color: #cc66cc;">5</span>  <span style="color: #66cc66;">&#125;</span>
  <span style="color: #cc66cc;">6</span>  <span style="color: #66cc66;">/</span>
<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;">AND</span> RESOLVE JAVA SOURCE NAMED HelloWorldSQL <span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #66cc66;">*</span>
ERROR at line <span style="color: #cc66cc;">1</span>:
ORA<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">29538</span>: Java <span style="color: #993333; font-weight: bold;">NOT</span> installed</pre></div></div>

<p>It also explains the lack of <code>loadjava</code> or <code>dropjava</code> from the <code>$ORACLE_HOME/bin</code> directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mclaughlinsoftware.com/2009/11/26/no-java-in-oracle-xe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Database trigger logic in Java?</title>
		<link>http://blog.mclaughlinsoftware.com/2008/11/27/database-trigger-logic-in-java/</link>
		<comments>http://blog.mclaughlinsoftware.com/2008/11/27/database-trigger-logic-in-java/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 03:32:06 +0000</pubDate>
		<dc:creator>maclochlainn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[ORA-04088]]></category>
		<category><![CDATA[ORA-29532]]></category>

		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?p=1065</guid>
		<description><![CDATA[I saw a post on the forum and fielded a question from my students on how you can write a database trigger that uses Java for the programming logic. I provided two approaches in this blog page. One lets Java raise the exception, which becomes an unhandled exception in SQL. The other implements the library [...]]]></description>
			<content:encoded><![CDATA[<p>I saw a post on the forum and fielded a question from my students on how you can write a database trigger that uses Java for the programming logic. I provided <a href="http://blog.mclaughlinsoftware.com/java-programming/java-trigger-sample/">two approaches in this blog page</a>. One lets Java raise the exception, which becomes an unhandled exception in SQL. The other implements the library as a function, and uses an IF statement to raise an exception &#8211; with <code>RAISE_APPLICATION_ERROR</code>.</p>
<p>I&#8217;m partial to the second approach but think the Fusion middleware may yet present a better option in the future. You should take a peak at the <a title="oracle.dss.util.TypeNotSupportedException" href="http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12063/oracle/dss/util/TypeNotSupportedException.html" target="_blank">oracle.dss.util.TypeNotSupportedException</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mclaughlinsoftware.com/2008/11/27/database-trigger-logic-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
