try {
if (con==null || con.isClosed()) con = getConnection(dbKey);
if(con==null) throw new ReportSQLException("Remote Connection not configured for "+ dbKey);
- Statement stmt = con.createStatement();
- logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql));
- ResultSet rs = stmt.executeQuery(sql);
- DataSet ds = new DataSet(rs, maxRowLimit);
- if(rs!=null)
- rs.close();
- if(stmt!=null)
- stmt.close();
-
- return ds;
+ try(Statement stmt = con.createStatement();
+ ResultSet rs = stmt.executeQuery(sql);){
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql));
+ return new DataSet(rs, maxRowLimit);
+ }
} catch (SQLException e) {
throw new ReportSQLException(e.getMessage(), sql, e.getCause());
- }
+ }
} // executeQuery
public static DataSet executeQuery(String sql,String dbKey) throws ReportSQLException {