Library Version 12.1.6.2

DB_TXN->abort()
Prev | Chapter 12. The DB_TXN Handle | Next

## DB_TXN->abort()

    #include <db.h>

    int
    DB_TXN->abort(DB_TXN *tid);

The `DB_TXN->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 DB_ENV->set_app_dispatch(). Before `DB_TXN->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 `DB_TXN->abort()` has been called, regardless of its return, the DB_TXN handle may not be accessed again.

The `DB_TXN->abort()` method returns a non-zero error value on failure and 0 on success.

### Class

DB_ENV, DB_TXN

### See Also

Transaction Subsystem and Related Methods

Prev | Up | Next
DB_ENV->txn_stat_print() | Home | DB_TXN->commit()