Re: bug with PGXADataSource in JNDI

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: bug with PGXADataSource in JNDI
Дата
Msg-id 45E312B2.2090809@enterprisedb.com
обсуждение исходный текст
Ответ на Re: bug with PGXADataSource in JNDI  (Heikki Linnakangas <heikki@enterprisedb.com>)
Ответы Re: bug with PGXADataSource in JNDI  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
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();

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: Calling functions with table-based-type parametars
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: bug with PGXADataSource in JNDI