<?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>dominikdorn.com &#187; PEAR</title>
	<atom:link href="http://dominikdorn.com/tag/pear/feed/" rel="self" type="application/rss+xml" />
	<link>http://dominikdorn.com</link>
	<description>shit happens ;)</description>
	<lastBuildDate>Tue, 03 Jan 2012 19:47:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Quercus + PostgreSQL + JNDI + PEAR::DB</title>
		<link>http://dominikdorn.com/2009/12/quercus-postgresql-jndi-peardb/</link>
		<comments>http://dominikdorn.com/2009/12/quercus-postgresql-jndi-peardb/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 02:16:05 +0000</pubDate>
		<dc:creator>Dominik Dorn</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[JNDI]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Quercus]]></category>

		<guid isPermaLink="false">http://dominikdorn.com/?p=146</guid>
		<description><![CDATA[If you trying to migrate a legacy PHP application which still uses PEAR::DB to Quercus with PostgreSQL and JDBC-Connection Pools accessible through JNDI, this may come handy for you! 1. Create your Datasource e.g. in Glassfish v3&#8242;s admin console&#8230; I named mine jdbc/postgresDS 2. copy the file pgsqljndi.php to /usr/share/php/DB/pgsqljndi.php (or wherever you include your [...]]]></description>
			<content:encoded><![CDATA[<p>If you trying to migrate a legacy PHP application which still uses PEAR::DB to Quercus with PostgreSQL and JDBC-Connection Pools accessible through JNDI, this may come handy for you!</p>
<p>1. Create your Datasource e.g. in Glassfish v3&#8242;s admin console&#8230; I named mine jdbc/postgresDS</p>
<p>2. copy the file <a href="http://gist.github.com/253923">pgsqljndi.php</a> to /usr/share/php/DB/pgsqljndi.php (or wherever you include your PEAR stuff from..)</p>
<p>3. change the database connection creation part of your script to this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span> DB<span style="color: #339933;">::</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pgsqljndi://java:comp/env/jdbc/postgresDS&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DB<span style="color: #339933;">::</span><span style="color: #004000;">isError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// error handling</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>4. remove stuff like this from your scripts</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET NAMES 'utf-8'; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Your database connection with PEAR::DB, Quercus, PostgreSQL, JDBC + JNDI should work now!</p>
]]></content:encoded>
			<wfw:commentRss>http://dominikdorn.com/2009/12/quercus-postgresql-jndi-peardb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

