All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeaninternal.util.JdbcClose Maven / Gradle / Ivy

There is a newer version: 8.1.1
Show newest version
package com.avaje.ebeaninternal.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * Utility for closing raw Jdbc resources.
 */
public class JdbcClose {

  private static final Logger logger = LoggerFactory.getLogger(JdbcClose.class);

  /**
   * Close the connection logging if an error occurs.
   */
  public static void close(Connection connection) {
    try {
      connection.close();
    } catch (SQLException e) {
      logger.warn("Error closing connection", e);
    }
  }

  /**
   * Rollback the connection logging if an error occurs.
   */
  public static void rollback(Connection connection) {
    try {
      connection.rollback();
    } catch (SQLException e) {
      logger.warn("Error on connection rollback", e);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy