Class DbUtils

java.lang.Object
io.jmix.reports.yarg.util.db.DbUtils

public final class DbUtils extends Object
A collection of JDBC helper methods. This class is thread safe.
  • Method Details

    • close

      public static void close(Connection conn) throws SQLException
      Close a Connection, avoid closing if null.
      Parameters:
      conn - Connection to close.
      Throws:
      SQLException - if a database access error occurs
    • close

      public static void close(ResultSet rs) throws SQLException
      Close a ResultSet, avoid closing if null.
      Parameters:
      rs - ResultSet to close.
      Throws:
      SQLException - if a database access error occurs
    • close

      public static void close(Statement stmt) throws SQLException
      Close a Statement, avoid closing if null.
      Parameters:
      stmt - Statement to close.
      Throws:
      SQLException - if a database access error occurs
    • closeQuietly

      public static void closeQuietly(Connection conn)
      Close a Connection, avoid closing if null and hide any SQLExceptions that occur.
      Parameters:
      conn - Connection to close.
    • closeQuietly

      public static void closeQuietly(Connection conn, Statement stmt, ResultSet rs)
      Close a Connection, Statement and ResultSet. Avoid closing if null and hide any SQLExceptions that occur.
      Parameters:
      conn - Connection to close.
      stmt - Statement to close.
      rs - ResultSet to close.
    • closeQuietly

      public static void closeQuietly(ResultSet rs)
      Close a ResultSet, avoid closing if null and hide any SQLExceptions that occur.
      Parameters:
      rs - ResultSet to close.
    • closeQuietly

      public static void closeQuietly(Statement stmt)
      Close a Statement, avoid closing if null and hide any SQLExceptions that occur.
      Parameters:
      stmt - Statement to close.