users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Tue, 24 Jul 2007 09:43:47 PDT

What files would you like? Here is the connection portion of my domain.xml

<jdbc-resource enabled="true" jndi-name="jdbc/jasperserver" object-type="user" pool-name="jasperPool"/>

    <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.postgresql.ds.PGConnectionPoolDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="false" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="jasperPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.ConnectionPoolDataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
      <property name="DatabaseName" value="jasperserver"/>
      <property name="LoginTimeout" value="0"/>
      <property name="Password" value="xxxxx"/>
      <property name="User" value="jasperserver"/>
      <property name="PrepareThreshold" value="0"/>
      <property name="PortNumber" value="5432"/>
      <property name="ServerName" value="localhost"/>
      <property name="MaxConnections" value="10"/>
      <property name="InitialConnections" value="2"/>
      <property name="DefaultAutoCommit" value="false"/>
    </jdbc-connection-pool>

I trying to get jasperserver working with the postrgres datasource but it will not work unless the DefaultAutoCommit is false.

They use spring and hibernate

Here is the spring bean that is used to get the dataSource

                <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
                <property name="jndiName" value="java:comp/env/jasperserver"/>
                </bean>

I can replace it with another datasource like the one that follows that uses the postgres driver directly and it works. This is why I believe that the defaultAutoCommit is just not being passed or retained by the glassfish pool manager. Either that or the postgres driver does not retian the setting when creating new connections in org.postgresql.ds.PGConnectionPoolDataSource class. I would think it would as the documention says it's there.


        <bean id="dataSource" destroy-method="close"
                class="org.apache.commons.dbcp.BasicDataSource">
                <property name="driverClassName"
                        value="org.postgresql.Driver" />
                <property name="url" value="jdbc:postgresql://localhost:5432/jasperserver?defaultAutoCommit=false" />
                <property name="username" value="jasperserver" />
                <property name="password" value="xxxxx" />
                <property name="defaultAutoCommit" value="false" />
        </bean>

thank you for your time so far.
[Message sent by forum member 'wizhippo' (wizhippo)]

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