protected void rethrow(SQLException cause,String sql,Object[] params) throws SQLException {
  StringBuilder msg=new StringBuilder(cause.getMessage());
  msg.append(" Query: ");
  msg.append(sql);
  msg.append(" Parameters: ");
  if (params == null) {
    msg.append("[]");
  }
 else {
    msg.append(Arrays.asList(params));
  }
  SQLException e=new SQLException(msg.toString(),cause.getSQLState(),cause.getErrorCode());
  e.setNextException(cause);
  throw e;
}

protected void rethrow ( SQLException cause , String sql , Object [ ] params ) throws SQLException { StringBuilder msg = new StringBuilder ( cause . getMessage ( ) ) ; msg . append ( " Query: " ) ; msg . append ( sql ) ; msg . append ( " Parameters: " ) ; if ( params == null ) { msg . append ( "[]" ) ; } else { msg . append ( Arrays . asList ( params ) ) ; } SQLException e = new SQLException ( msg . toString ( ) , cause . getSQLState ( ) , cause . getErrorCode ( ) ) ; e . setNextException ( cause ) ; throw e ; }
throws a new exception with a more informative error message .
