Will Druid's rollback reset connections that are set to autocommit to flase?

using the database connection pool to write code for batch operations (with transactions), always put conn.setAutoCommit (false);

first.

if there is an exception in the submitted code, conn.rollback () is executed. Do I need to set up setAutoCommit (true) again? ;

    try {
        conn = getConnection();
        conn.setAutoCommit(false);
        // 
        stmt.executeBatch();
        conn.commit();
        stmt.clearBatch();
        // 
        conn.setAutoCommit(true);
    } catch (Exception e) {
        if (conn != null) {
            conn.rollback();
        }
    } finally {
        if (conn != null) {
            // 
            conn.setAutoCommit(true);
            conn.close();
        }
}
Mar.20,2021

there is no need to set up conn.setAutoCommit (true);

conn.close();autoCommittrue.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5d139-456f0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5d139-456f0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?