You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by le...@apache.org on 2005/02/11 03:29:28 UTC

svn commit: r153323 - in excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource: PoolSettable.java ResourceLimitingJdbcConnectionPool.java

Author: leif
Date: Thu Feb 10 18:29:26 2005
New Revision: 153323

URL: http://svn.apache.org/viewcvs?view=rev&rev=153323
Log:
Modify the pool so that Connections always have their AutoCommit status reset before being returned to requesting code.  This is to avoid very hard to track down problems where a component changes the autoCommit status and then returns the connection to the pool without restoring it.  If another component is expecting auto commit behavior but the connection is working in a transaction.

Modified:
    excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/PoolSettable.java
    excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcConnectionPool.java

Modified: excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/PoolSettable.java
URL: http://svn.apache.org/viewcvs/excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/PoolSettable.java?view=diff&r1=153322&r2=153323
==============================================================================
--- excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/PoolSettable.java (original)
+++ excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/PoolSettable.java Thu Feb 10 18:29:26 2005
@@ -38,5 +38,7 @@
     void setPool( Pool pool );
     
     boolean isClosed() throws SQLException;
+    
+    void setAutoCommit( boolean autoCommit ) throws SQLException;
 }
 

Modified: excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcConnectionPool.java
URL: http://svn.apache.org/viewcvs/excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcConnectionPool.java?view=diff&r1=153322&r2=153323
==============================================================================
--- excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcConnectionPool.java (original)
+++ excalibur/trunk/components/datasource/src/java/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcConnectionPool.java Thu Feb 10 18:29:26 2005
@@ -105,7 +105,7 @@
 
         return conn;
     }
-
+    
     /**
      * Validates the poolable before it is provided to the caller of get on this pool.
      *  This implementation of the validation method always returns true indicating
@@ -129,6 +129,10 @@
                 getLogger().debug( "JdbcConnection was closed." );
                 return false;
             }
+            
+            // Always reset the auto commit flag in case a previous user has modified it.
+            //  If the user forgot to commit then this may cause a commit.
+            conn.setAutoCommit( m_autoCommit );
         }
         catch( SQLException e )
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org