
net.dongliu.dbutils.Utils Maven / Gradle / Ivy
package net.dongliu.dbutils;
import net.dongliu.dbutils.exception.UncheckedSQLException;
import javax.annotation.Nullable;
import java.sql.Connection;
import java.sql.SQLException;
/**
* A collection of JDBC helper methods. This class is thread safe.
*/
public final class Utils {
/**
* Close a Connection, avoid closing if null.
*
* @param conn Connection to close.
*/
public static void close(@Nullable Connection conn) {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
throw new UncheckedSQLException(e);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy