Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 115759FB352 for ; Mon, 26 Feb 2007 13:03:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 29985-08 for ; Mon, 26 Feb 2007 13:03:04 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) by postgresql.org (Postfix) with ESMTP id E32E49FB347 for ; Mon, 26 Feb 2007 13:03:04 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so724966ugf for ; Mon, 26 Feb 2007 09:03:04 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:sender; b=oc8WjfDJQd/Yj3r0/PD3qdeB5C+q8pCFSZMzVo+4w1u0ZfyRyWruCHYo4E3+sRWkjUXLHHJ38aPyufKNYOs5zmyvGdnRySlXaFY5woWz3l3mU0bl6ggMBnqHWQ+8zzckQUixKwnEHUYVstHxaEYRxl7BTlPLwOUr0eJoI8RZ7x0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:sender; b=pZCuX2wpkF+c5ca/7E4Cm/OLkDonDCn+KvGdMfrAhmZ+gwQgLnv/BMvRZaFMAAyjPxFiIimGL3tKBnDsQAhy/xhlewUxjiYCBPT8ECD0bRD+lf9SQnHddEo7bQ6pZytZIHImboWwEQaGiVlKc9qeifOHjL8oioY81hxApMuwNns= Received: by 10.67.29.12 with SMTP id g12mr6669367ugj.1172509383949; Mon, 26 Feb 2007 09:03:03 -0800 (PST) Received: from ?172.24.32.68? ( [62.232.55.118]) by mx.google.com with ESMTP id e33sm6136046ugd.2007.02.26.09.03.01; Mon, 26 Feb 2007 09:03:02 -0800 (PST) Message-ID: <45E312B2.2090809@enterprisedb.com> Date: Mon, 26 Feb 2007 17:02:42 +0000 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.8 (X11/20061116) MIME-Version: 1.0 To: Jonathan Halliday CC: pgsql-jdbc@postgresql.org Subject: Re: bug with PGXADataSource in JNDI References: <45DF5511.1040601@redhat.com> <45E30891.1070102@enterprisedb.com> In-Reply-To: <45E30891.1070102@enterprisedb.com> Content-Type: multipart/mixed; boundary="------------040700090904080409090502" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/131 X-Sequence-Number: 16687 This is a multi-part message in MIME format. --------------040700090904080409090502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------040700090904080409090502 Content-Type: text/x-patch; name="xa-PGObjectFactory-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xa-PGObjectFactory-fix.patch" ? 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(); --------------040700090904080409090502--