pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Jonathan Halliday <jonathan.halliday@redhat.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: bug with PGXADataSource in JNDI
Date: Mon, 26 Feb 2007 17:02:42 +0000
Message-ID: <45E312B2.2090809@enterprisedb.com> (raw)
In-Reply-To: <45E30891.1070102@enterprisedb.com>
References: <45DF5511.1040601@redhat.com>
	<45E30891.1070102@enterprisedb.com>

Heikki Linnakangas wrote:
> Jonathan Halliday wrote:
>>
>> Hello JDBC driver developers
>>
>> I have a requirement to store and retrieve PGXADataSource instances 
>> from JNDI, specifically using Sun's fscontext provider.
>>
>> I can get instances into JNDI no problem and they are written out to 
>> the .bindings file.
>>
>> I can't retrieve them because PGObjectFactory.getObjectInstance does 
>> not know about ClassName=org.postgresql.xa.PGXADataSource
>>
>> Please would one of the developers address this for the next 8.1 
>> driver release.
> 
> I can write the patch to fix that. Do you happen to have a simple test 
> case I can use to test it?

Thanks, I got your test case off-list.

Here's the patch against CVS head. It should apply cleanly to 8.1 branch 
as well.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Attachments:

xa-PGObjectFactory-fix.patch (text/x-patch, 1.6K) download ? xa-PGObjectFactory-fix.patch ? xa-endthenjoin-2.diff ? xa-endthenjoin.diff Index: org/postgresql/ds/common/PGObjectFactory.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/ds/common/PGObjectFactory.java,v retrieving revision 1.5 diff -c -r1.5 PGObjectFactory.java *** org/postgresql/ds/common/PGObjectFactory.java 11 Jan 2005 08:25:45 -0000 1.5 --- org/postgresql/ds/common/PGObjectFactory.java 26 Feb 2007 16:59:38 -0000 *************** *** 14,19 **** --- 14,20 ---- import java.util.Hashtable; import org.postgresql.ds.*; + import org.postgresql.xa.PGXADataSource; /** * Returns a DataSource-ish thing based on a JNDI reference. In the case of a *************** *** 42,47 **** --- 43,52 ---- { return loadSimpleDataSource(ref); } + else if (className.equals("org.postgresql.xa.PGXADataSource")) + { + return loadXADataSource(ref); + } else if (className.equals("org.postgresql.ds.PGConnectionPoolDataSource") || className.equals("org.postgresql.jdbc2.optional.ConnectionPool") || className.equals("org.postgresql.jdbc3.Jdbc3ConnectionPool")) *************** *** 92,97 **** --- 97,108 ---- return loadBaseDataSource(ds, ref); } + private Object loadXADataSource(Reference ref) + { + PGXADataSource ds = new PGXADataSource(); + return loadBaseDataSource(ds, ref); + } + private Object loadConnectionPool(Reference ref) { PGConnectionPoolDataSource cp = new PGConnectionPoolDataSource();

view thread (6+ messages)  latest in thread

Message-ID: <45E312B2.2090809@enterprisedb.com>
Permalink:  ../45E312B2.2090809@enterprisedb.com/
Also on:    postgresql.org/message-id/45E312B2.2090809@enterprisedb.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: heikki@enterprisedb.com, jonathan.halliday@redhat.com
  Subject: Re: bug with PGXADataSource in JNDI
  In-Reply-To: <45E312B2.2090809@enterprisedb.com>
  References: <45DF5511.1040601@redhat.com> <45E30891.1070102@enterprisedb.com> <45E312B2.2090809@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox