Unix Technical Forum

defaultAutoCommit problem with glassfish

This is a discussion on defaultAutoCommit problem with glassfish within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> I have been trying to setup a dataSource in glassfish that needs to have the defaultAutoCommit = false using ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008, 12:49 AM
Douglas Hammond
 
Posts: n/a
Default defaultAutoCommit problem with glassfish

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.PGConnectionPoolDataSourc e">
<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.SharedP oolDataSource">
<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.PGConnectionPoolDataSourc e">
<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.SharedP oolDataSource">
<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.SharedPoolData Source.

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?

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2008, 12:49 AM
Oliver Jowett
 
Posts: n/a
Default Re: defaultAutoCommit problem with glassfish

Douglas Hammond wrote:

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


> <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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-16-2008, 12:49 AM
Albe Laurenz
 
Posts: n/a
Default Re: defaultAutoCommit problem with glassfish

Oliver Jowett wrote:
>> <bean id="dsAdapter" destroy-method="close"
>> class="org.postgresql.ds.PGConnectionPoolDataSourc e">

>
>> <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#setDe faultAutoCommit(boolea
n)

and an

org.postgresql.ds.PGConnectionPoolDataSource#isDef aultAutoCommit()

Yours,
Laurenz Albe

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-16-2008, 12:49 AM
Oliver Jowett
 
Posts: n/a
Default Re: defaultAutoCommit problem with glassfish

Albe Laurenz wrote:
> Oliver Jowett wrote:
>>> <bean id="dsAdapter" destroy-method="close"
>>> class="org.postgresql.ds.PGConnectionPoolDataSourc e">
>>> <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#setDe faultAutoCommit(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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:43 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com