pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
defaultAutoCommit problem with glassfish
4+ messages / 3 participants
[nested] [flat]

* defaultAutoCommit problem with glassfish
@ 2007-07-25 15:02 Douglas Hammond <wizhippo@gmail.com>
  2007-07-25 22:08 ` Re: defaultAutoCommit problem with glassfish Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Douglas Hammond @ 2007-07-25 15:02 UTC (permalink / raw)
  To: pgsql-jdbc

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?



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: defaultAutoCommit problem with glassfish
  2007-07-25 15:02 defaultAutoCommit problem with glassfish Douglas Hammond <wizhippo@gmail.com>
@ 2007-07-25 22:08 ` Oliver Jowett <oliver@opencloud.com>
  2007-07-26 07:58   ` Re: defaultAutoCommit problem with glassfish Albe Laurenz <all@adv.magwien.gv.at>
  0 siblings, 1 reply; 4+ messages in thread

From: Oliver Jowett @ 2007-07-25 22:08 UTC (permalink / raw)
  To: Douglas Hammond <wizhippo@gmail.com>; +Cc: pgsql-jdbc

Douglas Hammond wrote:

>       <bean id="dsAdapter" destroy-method="close"
>               class="org.postgresql.ds.PGConnectionPoolDataSource">

>               <property name="defaultAutoCommit" value="false" />

AFAIK there is no javabean accessor on PGConnectionPoolDataSource for a 
property named "defaultAutoCommit".

If you try to set some obviously incorrect property 
("thisPropertyDoesNotExist"), what happens? The bug may be that whatever 
is building the DS from the XML is silently ignoring properties that it 
can't find an accessor for, rather than complaining about misconfiguration.

-O



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: defaultAutoCommit problem with glassfish
  2007-07-25 15:02 defaultAutoCommit problem with glassfish Douglas Hammond <wizhippo@gmail.com>
  2007-07-25 22:08 ` Re: defaultAutoCommit problem with glassfish Oliver Jowett <oliver@opencloud.com>
@ 2007-07-26 07:58   ` Albe Laurenz <all@adv.magwien.gv.at>
  2007-07-26 08:39     ` Re: defaultAutoCommit problem with glassfish Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Albe Laurenz @ 2007-07-26 07:58 UTC (permalink / raw)
  To: Oliver Jowett *EXTERN* <oliver@opencloud.com>; Douglas Hammond <wizhippo@gmail.com>; +Cc: pgsql-jdbc

Oliver Jowett wrote:
>>       <bean id="dsAdapter" destroy-method="close"
>>               class="org.postgresql.ds.PGConnectionPoolDataSource">
> 
>>               <property name="defaultAutoCommit" value="false" />
> 
> AFAIK there is no javabean accessor on
> PGConnectionPoolDataSource for a property named "defaultAutoCommit".

At least in CVS HEAD there is an

org.postgresql.ds.PGConnectionPoolDataSource#setDefaultAutoCommit(boolea
n)

and an

org.postgresql.ds.PGConnectionPoolDataSource#isDefaultAutoCommit()

Yours,
Laurenz Albe



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: defaultAutoCommit problem with glassfish
  2007-07-25 15:02 defaultAutoCommit problem with glassfish Douglas Hammond <wizhippo@gmail.com>
  2007-07-25 22:08 ` Re: defaultAutoCommit problem with glassfish Oliver Jowett <oliver@opencloud.com>
  2007-07-26 07:58   ` Re: defaultAutoCommit problem with glassfish Albe Laurenz <all@adv.magwien.gv.at>
@ 2007-07-26 08:39     ` Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Oliver Jowett @ 2007-07-26 08:39 UTC (permalink / raw)
  To: Albe Laurenz <all@adv.magwien.gv.at>; +Cc: Douglas Hammond <wizhippo@gmail.com>; pgsql-jdbc

Albe Laurenz wrote:
> Oliver Jowett wrote:
>>>       <bean id="dsAdapter" destroy-method="close"
>>>               class="org.postgresql.ds.PGConnectionPoolDataSource">
>>>               <property name="defaultAutoCommit" value="false" />
>> AFAIK there is no javabean accessor on
>> PGConnectionPoolDataSource for a property named "defaultAutoCommit".
> 
> At least in CVS HEAD there is an
> 
> org.postgresql.ds.PGConnectionPoolDataSource#setDefaultAutoCommit(boolea
> n)

Oops. Not sure how I missed that the first time around, I did look for 
it! Not sure what is going on then.

To the OP: what exactly is the failure that you see when trying to use 
the defaultAutoCommit property on the PG datasource?

-O



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2007-07-26 08:39 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25 15:02 defaultAutoCommit problem with glassfish Douglas Hammond <wizhippo@gmail.com>
2007-07-25 22:08 ` Oliver Jowett <oliver@opencloud.com>
2007-07-26 07:58   ` Albe Laurenz <all@adv.magwien.gv.at>
2007-07-26 08:39     ` Oliver Jowett <oliver@opencloud.com>

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