Java Utililty Methods JDBC Collection Transaction

List of utility methods to do JDBC Collection Transaction

Description

The list of methods to do JDBC Collection Transaction are organized into topic(s).

Method

voidcommit(Connection conn)
Commit a transaction without an exception even if it has an error.
try {
    if (conn != null) {
        conn.commit();
} catch (Exception ignored) {
voidcommit(Connection conn)
commit
try {
    if (conn == null || conn.isClosed()) {
        return;
    conn.commit();
} catch (SQLException e) {
    throw new RuntimeException("Committed error:" + e.getMessage(), e);
booleancommit(Connection conn)
Commit all transactions associated with the specified connection
try {
    if (!conn.getAutoCommit()) {
        conn.commit();
        return true;
} catch (Throwable t) {
return false;
...
voidcommit(Connection conn)
commit
try {
    conn.commit();
} catch (SQLException e) {
    throw new RuntimeException(e);
voidcommit(Connection conn)
commit
if (conn != null) {
    try {
        conn.close();
    } catch (SQLException e) {
        e.printStackTrace();
voidcommit(Connection connection)
Attempts to commit any submitted SQL statements using a given connection.
String methodName = "commit";
try {
    if (connection != null && !connection.getAutoCommit()) {
        connection.commit();
} catch (SQLException sqlException) {
    Logger logger = Logger.getLogger("com.bws.jdistil.core.datasource.database");
    logger.logp(Level.SEVERE, className, methodName, "Committing SQL Statements", sqlException);
...
voidcommitAndClose(Connection conn)
Commits a Connection then closes it, avoid closing if null.
if (conn == null) {
    throw new IllegalArgumentException(
            "Given connection is null although trying to commit the transaction.");
try {
    conn.commit();
} finally {
    conn.close();
...
voidcommitAndClose(Connection conn)
commit And Close
if (conn != null) {
    try {
        conn.commit();
    } finally {
        conn.close();
voidcommitAndClose(Connection connection)
Commits a Connection then closes it, avoid closing if null.
if (connection != null) {
    try {
        if (!connection.getAutoCommit()) {
            connection.commit();
    } finally {
        connection.close();
voidcommitAndClose(Connection connection)
Commit and close.
try {
    commit(connection);
} finally {
    close(connection);