diff --git a/org.adempiere.base/src/org/compiere/db/PreparedStatementProxy.java b/org.adempiere.base/src/org/compiere/db/PreparedStatementProxy.java index dcfedcad66..b6b4c44d29 100644 --- a/org.adempiere.base/src/org/compiere/db/PreparedStatementProxy.java +++ b/org.adempiere.base/src/org/compiere/db/PreparedStatementProxy.java @@ -15,6 +15,7 @@ package org.compiere.db; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.util.logging.Level; import javax.sql.RowSet; @@ -95,6 +96,11 @@ public class PreparedStatementProxy extends StatementProxy { p_stmt = conn.prepareStatement(p_vo.getSql(), p_vo .getResultSetType(), p_vo.getResultSetConcurrency()); } catch (Exception e) { + try { + this.close(); + } catch (SQLException e1) { + // ignore + } log.log(Level.SEVERE, p_vo.getSql(), e); throw new DBException(e); } diff --git a/org.adempiere.base/src/org/compiere/db/StatementProxy.java b/org.adempiere.base/src/org/compiere/db/StatementProxy.java index ff59984f32..9fd61a7d8e 100644 --- a/org.adempiere.base/src/org/compiere/db/StatementProxy.java +++ b/org.adempiere.base/src/org/compiere/db/StatementProxy.java @@ -184,7 +184,7 @@ public class StatementProxy implements InvocationHandler { * @throws SQLException * @see java.sql.Statement#close() */ - private void close () throws SQLException + protected void close () throws SQLException { if (close) return;