Library Version 12.1.6.0

DbTxn::abort()
Prev | Chapter 13. The DbTxn Handle | Next

## DbTxn::abort()

    #include <db_cxx.h>

    int
    DbTxn::abort();

The `DbTxn::abort()` method causes an abnormal termination of the transaction. The log is played backward, and any necessary undo operations are done through the tx_recover function specified to DbEnv::set_app_dispatch(). Before `DbTxn::abort()` returns, any locks held by the transaction will have been released.

In the case of nested transactions, aborting a parent transaction causes all children (unresolved or not) of the parent transaction to be aborted.

All cursors opened within the transaction must be closed before the transaction is aborted. If they are not closed, they will be closed by this function. If a close operation fails, the rest of the cursors are closed, and the database environment is set to the panic state.

After `DbTxn::abort()` has been called, regardless of its return, the DbTxn handle may not be accessed again.

The `DbTxn::abort()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Class

DbEnv, DbTxn

### See Also

Transaction Subsystem and Related Methods

Prev | Up | Next
DbEnv::txn_stat_print() | Home | DbTxn::commit()