Library Version 11.2.5.3

Chapter 12. The DB_TXN Handle
Prev |  | Next

## Chapter 12. The DB_TXN Handle

    #include <db.h>

    typedef struct __db_txn DB_TXN;

The `DB_TXN` object is the handle for a transaction. Methods of the `DB_TXN` handle are used to configure, abort and commit the transaction. `DB_TXN` handles are provided to DB methods in order to transactionally protect those database operations.

`DB_TXN` handles are not free-threaded; transactions handles may be used by multiple threads, but only serially, that is, the application must serialize access to the `DB_TXN` handle. Once the DB_TXN->abort() or DB_TXN->commit() methods are called, the handle may not be accessed again, regardless of the method's return. In addition, parent transactions may not issue any Berkeley DB operations while they have active child transactions (child transactions that have not yet been committed or aborted) except for DB_ENV->txn_begin(), DB_TXN->abort() and DB_TXN->commit().

## Transaction Subsystem and Related Methods

Transaction Subsystem and Related Methods | Description
--- | ---
DB_ENV->txn_recover() | Distributed transaction recovery
DB_ENV->txn_checkpoint() | Checkpoint the transaction subsystem
DB_ENV->txn_stat() | Return transaction subsystem statistics
DB_ENV->txn_stat_print() | Print transaction subsystem statistics
DB_TXN->set_timeout() | Set transaction timeout
Transaction Subsystem Configuration
DB_ENV->set_timeout(), DB_ENV->get_timeout() | Set/get lock and transaction timeout
DB->get_transactional() | Does the DB have transaction support
DB_ENV->cdsgroup_begin() | Get a locker ID in Berkeley DB Concurrent Data Store
DB_ENV->set_tx_max(), DB_ENV->get_tx_max() | Set/get maximum number of transactions
DB_ENV->set_tx_timestamp(), DB_ENV->get_tx_timestamp() | Set/get recovery timestamp
Transaction Operations
DB_ENV->txn_begin() | Begin a transaction
DB_TXN->abort() | Abort a transaction
DB_TXN->commit() | Commit a transaction
DB_TXN->discard() | Discard a prepared but not resolved transaction handle
DB_TXN->id() | Return a transaction's ID
DB_TXN->prepare() | Prepare a transaction for commit
DB_TXN->set_name(), DB_TXN->get_name() | Associate a string with a transaction
DB_TXN->set_priority(), DB_TXN->get_priority() | Set/get transaction's priority

Prev |  | Next
DB_SEQUENCE->stat_print() | Home | DB->get_transactional()