summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java
index 3a08edca..8e4def24 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java
@@ -181,19 +181,14 @@ public class RemDbUtils /* implements IDbUtils */{
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 {