pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: markds75 <markds75@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PostgreSQL (XADataSource) as Tomcat Resource
Date: Sun, 9 Apr 2006 11:50:24 +0300 (EEST)
Message-ID: <Pine.OSF.4.61.0604091059250.169983@kosh.hut.fi> (raw)
In-Reply-To: <1144263998.675528.212920@t31g2000cwb.googlegroups.com>
References: <1144263998.675528.212920@t31g2000cwb.googlegroups.com>

On Wed, 5 Apr 2006, markds75 wrote:

> How can I get Postgres to be deployed in Tomcat's JNDI as an
> XADataSource?
>
> I'm running my web app in Tomcat, and I'm moving towards distributed
> transactions for my two data sources (JDO and JCR). I've got the Jencks
> library providing JTA support (based on Geronimo's TransactionManager)
> within Tomcat. Currently, I have Postgres configured as a local web-app
> Resource as follows:
>
> <Resource name="jdbc/whisper_db"
>    auth="Container"
>    type="javax.sql.DataSource"
>    url="jdbc:postgresql://127.0.0.1:5432/my_db"
>    driverClassName="org.postgresql.Driver"
>    username="----------------"
>    password="----------------"
>    maxWait="3000"
>    maxIdle="100"
>    maxActive="10" />
>
> The web-app is able to start up without errors in this case and things
> function as expected. However, I've been told that I should be using an
> XADataSource if I want JDO to participate in distributed transactions
> (specifically, I'm trying to get 2 phase commit). When I change the
> type to "javax.sql.XADataSource", the web-app fails to start because
> Tomcat cannot create the JNDI entry. I'm running under Java 1.5, so to
> my knowledge XADataSource is included.
>
> Any pointers would be appreciated.

I don't know how to do it, but you certainly shouldn't have the driver 
class name (org.postgresql.Driver) there. That's only used for non-XA 
connections. You should somehow tell it that the class implementing 
XADataSource is org.postgresql.xa.PGXADataSource.

I don't know anything about Jencks, but it seems that it uses the 
TranQL connector module from Geronimo to glue in XADataSource 
implementations. Unfortunately, there's no TranQL connector for 
PostgreSQL. Fortunately, it shouldn't be too hard to write one, using the 
existing connectors as an example.

However, I would suggest using another app server / JTA implementation. I 
had success with JOnAS, which includes JOTM as it's JTA implementation. 
JBoss should work too.

- Heikki



view thread (7+ messages)

Message-ID: <Pine.OSF.4.61.0604091059250.169983@kosh.hut.fi>
Permalink:  ../Pine.OSF.4.61.0604091059250.169983@kosh.hut.fi/
Also on:    postgresql.org/message-id/Pine.OSF.4.61.0604091059250.169983@kosh.hut.fi

 · 

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: hlinnaka@iki.fi, markds75@gmail.com
  Subject: Re: PostgreSQL (XADataSource) as Tomcat Resource
  In-Reply-To: <Pine.OSF.4.61.0604091059250.169983@kosh.hut.fi>
  References: <1144263998.675528.212920@t31g2000cwb.googlegroups.com> <Pine.OSF.4.61.0604091059250.169983@kosh.hut.fi>

* 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