Hello,


i would like to know if there is a way to print prepared statement SQL if SQLException occurs.



in JDBCTemplate class catch (SQLException ex) , the parameters of the prepareStatem are removed from SQL just before calling getExceptionTranslator().translate("PreparedStatem entCallback", sql, ex);



code from JDBCTemplate :


catch (SQLException ex) {
// Release Connection early, to avoid potential connection pool deadlock
// in the case when the exception translator hasn't been initialized yet.
if (psc instanceof ParameterDisposer) {
((ParameterDisposer) psc).cleanupParameters();
}
String sql = getSql(psc);
psc = null;
JdbcUtils.closeStatement(ps);
ps = null;
DataSourceUtils.releaseConnection(con, getDataSource());
con = null;
throw getExceptionTranslator().translate("PreparedStatem entCallback", sql, ex);
}



Question : does there is a way to redifine getSql() method to prevent it to remove parameters ?


regards,
jfdesmar