users@glassfish.java.net

Re: Does the jdbc pool manager support setting the defaultAutoCommit?

From: <glassfish_at_javadesktop.org>
Date: Wed, 25 Jul 2007 07:51:55 PDT

Since you can't use org.postgresql.ds.PGConnectionPoolDataSource directly
This is what I did, I believe should be what you wanted me to test.

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

Since the apache SharedPoolDataSource manages the a defaultAutoCommit
properly I would suggest that the glassfish pool manager should also.

Should this be submitted as a bug?
[Message sent by forum member 'wizhippo' (wizhippo)]

http://forums.java.net/jive/thread.jspa?messageID=228168