Committing connection if autoCommit is false.
authorkfujino <kfujino@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 2 Aug 2011 11:51:20 +0000 (11:51 +0000)
committerkfujino <kfujino@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 2 Aug 2011 11:51:20 +0000 (11:51 +0000)
Make sure committed connection is returned to the pool if datasource is enabled.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1153099 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/session/JDBCStore.java
java/org/apache/catalina/session/LocalStrings.properties
webapps/docs/changelog.xml

index ed17851..bfbfa96 100644 (file)
@@ -1015,6 +1015,15 @@ public class JDBCStore extends StoreBase {
             ExceptionUtils.handleThrowable(f);
         }
         this.preparedLoadSql = null;
+        
+        // Commit if autoCommit is false
+        try {
+            if (!dbConnection.getAutoCommit()) {
+                dbConnection.commit();
+            }            
+        } catch (SQLException e) {
+            manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".commitSQLException"), e);
+        }
 
         // Close this database connection, and log any errors
         try {
index 8359ead..c3d0c74 100644 (file)
@@ -29,6 +29,7 @@ JDBCStore.checkConnectionSQLException=A SQL exception occurred {0}
 JDBCStore.checkConnectionClassNotFoundException=JDBC driver class not found {0}
 JDBCStore.wrongDataSource=Cannot open JNDI DataSource [{0}]
 JDBCStore.missingDataSourceName=No valid JNDI name was given.
+JDBCStore.commitSQLException=SQLException committing connection before closing
 managerBase.createRandom=Created random number generator for session ID generation in {0}ms.
 managerBase.createSession.ise=createSession: Too many active sessions
 managerBase.sessionTimeout=Invalid session timeout setting {0}
index d6f60b0..35bf64d 100644 (file)
         of a Servlet instance always do so in way that correctly instantiates a
         Servlet instance. (markt)
       </fix>
+      <fix>
+        Committing connection if autoCommit is false.
+        Make sure committed connection is returned to the pool if datasource is 
+        enabled. (kfujino)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">