Author: upul
Date: Wed Jan 16 21:49:18 2008
New Revision: 612719

URL: http://svn.apache.org/viewvc?rev=612719&view=rev
Log:
dblookup - fixed db connection closing after use

Modified:
    
webservices/synapse/branches/1.1.1/modules/core/src/main/java/org/apache/synapse/mediators/db/DBLookupMediator.java

Modified: 
webservices/synapse/branches/1.1.1/modules/core/src/main/java/org/apache/synapse/mediators/db/DBLookupMediator.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/branches/1.1.1/modules/core/src/main/java/org/apache/synapse/mediators/db/DBLookupMediator.java?rev=612719&r1=612718&r2=612719&view=diff
==============================================================================
--- 
webservices/synapse/branches/1.1.1/modules/core/src/main/java/org/apache/synapse/mediators/db/DBLookupMediator.java
 (original)
+++ 
webservices/synapse/branches/1.1.1/modules/core/src/main/java/org/apache/synapse/mediators/db/DBLookupMediator.java
 Wed Jan 16 21:49:18 2008
@@ -24,6 +24,7 @@
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Connection;
 import java.util.Iterator;
 
 /**
@@ -38,8 +39,10 @@
 
         // execute the prepared statement, and extract the first result row and
         // set as message context properties, any results that have been 
specified
+        Connection con = null;
         try {
             PreparedStatement ps = getPreparedStatement(stmnt, msgCtx);
+            con = ps.getConnection();
             ResultSet rs = ps.executeQuery();
 
             if (rs.next()) {
@@ -86,6 +89,12 @@
         } catch (SQLException e) {
             handleException("Error executing statement : " + 
stmnt.getRawStatement() +
                 " against DataSource : " + getDSName(), e, msgCtx);
+        } finally {
+            if (con != null) {
+                try {
+                    con.close();
+                } catch (SQLException ignore) {}
+            }
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to