Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: bug with PGXADataSource in JNDI



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
? 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();


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group