pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Douglas Hammond <wizhippo@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: defaultAutoCommit problem with glassfish
Date: Wed, 25 Jul 2007 11:02:21 -0400
Message-ID: <198625570707250802k5a325718ic805df8201ba020b@mail.gmail.com> (raw)

I have been trying to setup a dataSource in glassfish that needs to
have the defaultAutoCommit = false using
org.postgresql.ds.PGConnectionPoolDataSource.

I am using the postgresql-jdbc-8.3dev-600 driver.

It does not work for me.  It seams that glassfish is relying on the
driver to set and retain the defaultAutoCommit state.  I do not know
if the driver should retian this or the pool manager should.

Here is what I have done to find that the postgres jdbc driver does
not retain the defaultAutoCommit state for new connections.  At least
I think this is what is happening.

Since you can't use org.postgresql.ds.PGConnectionPoolDataSource directly
This is what I did.

       <bean id="dsAdapter" destroy-method="close"
               class="org.postgresql.ds.PGConnectionPoolDataSource">
               <property name="serverName" value="localhost" />
               <property name="databaseName" value="jasperserver" />
               <property name="portNumber" value="5432" />
               <property name="user" value="jasperserver" />
               <property name="password" value="xxxx" />
               <property name="defaultAutoCommit" value="false" />
       </bean>

       <bean id="dataSource"
               class="org.apache.commons.dbcp.datasources.SharedPoolDataSource">
               <property name="connectionPoolDataSource">
                       <ref local="dsAdapter"></ref>
               </property>
               <property name="maxActive" value="5" />
               <property name="maxIdle" value="4" />
               <property name="maxWait" value="10000" />
       </bean>


This does NOT work

I thought I would try

       <bean id="dsAdapter" destroy-method="close"
               class="org.postgresql.ds.PGConnectionPoolDataSource">
               <property name="serverName" value="localhost" />
               <property name="databaseName" value="jasperserver" />
               <property name="portNumber" value="5432" />
               <property name="user" value="jasperserver" />
               <property name="password" value="hippo" />
       </bean>

       <bean id="dataSource"
               class="org.apache.commons.dbcp.datasources.SharedPoolDataSource">
               <property name="connectionPoolDataSource">
                       <ref local="dsAdapter"></ref>
               </property>
               <property name="defaultAutoCommit" value="false" />
               <property name="maxActive" value="5" />
               <property name="maxIdle" value="4" />
               <property name="maxWait" value="10000" />
       </bean>

I moved the defaultAutoCommit into the
org.apache.commons.dbcp.datasources.SharedPoolDataSource.

It WORKS.

It looks like postgresql jdbc driver is relying on the pool manager to
set or keep the autoCommit state.

I do not know if this is proper behavier or not.

Should this be submitted as a bug?



view thread (4+ messages)  latest in thread

Message-ID: <198625570707250802k5a325718ic805df8201ba020b@mail.gmail.com>
Permalink:  ../198625570707250802k5a325718ic805df8201ba020b@mail.gmail.com/
Also on:    postgresql.org/message-id/198625570707250802k5a325718ic805df8201ba020b@mail.gmail.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: wizhippo@gmail.com
  Subject: Re: defaultAutoCommit problem with glassfish
  In-Reply-To: <198625570707250802k5a325718ic805df8201ba020b@mail.gmail.com>
  References: <198625570707250802k5a325718ic805df8201ba020b@mail.gmail.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