If the connection is in AUTO_COMMIT mode any query over the connection will be wrapped around a transaction and committed (even if the query is READ_ONLY). If the connection is in MANUAL transaction mode, which happens only if an application manually begins a transaction (see below), then an application has to manually commit or rollback the transaction by calling commit() or rollback().
AUTO_COMMIT is the default mode when a Connection is created. If an application calls begin[ReadOnly/Write]Transaction at any point, the mode switches to MANUAL. This creates an "active transaction" in the connection. When a connection is in MANUAL mode and the active transaction is rolled back or committed, then the active transaction is removed (so the connection no longer has an active transaction) and the mode automatically switches back to AUTO_COMMIT. Note: When a Connection object is deconstructed, if the connection has an active (manual) transaction, then the active transaction is rolled back.