You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2007/07/10 23:13:30 UTC

svn commit: r555078 - /beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java

Author: cschoett
Date: Tue Jul 10 14:13:28 2007
New Revision: 555078

URL: http://svn.apache.org/viewvc?view=rev&rev=555078
Log:
Fix for BEEHIVE-1201, applied patch submitted by Steven Dalton which releases prepared statements when using the JDBC control setConnection API.

DRTs: JDBC control drts passed


Modified:
    beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java

Modified: beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java?view=diff&rev=555078&r1=555077&r2=555078
==============================================================================
--- beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java (original)
+++ beehive/trunk/system-controls/src/jdbc/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java Tue Jul 10 14:13:28 2007
@@ -140,10 +140,7 @@
         if (LOGGER.isDebugEnabled()) {
             LOGGER.debug("Enter: onRelease()");
         }
-
-        if (_connection != null && !_externalConnection) {
-            cleanupConnection();
-        }
+        cleanupConnection();
     }
 
     /**
@@ -411,15 +408,17 @@
         }
         getResources().clear();
 
-        try {
-            _connection.close();
-        }
-        catch (SQLException e) {
-            throw new ControlException("SQL Exception while attempting to close database connection.", e);
-        }
+        if (_connection != null && !_externalConnection) {
+            try {
+                _connection.close();
+            }
+            catch (SQLException e) {
+                throw new ControlException("SQL Exception while attempting to close database connection.", e);
+            }
 
-        _connection = null;
-        _externalConnection = false;
+            _connection = null;
+            _externalConnection = false;
+        }
     }
 
     /**