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

## DB_TXN->set_name()

    #include <db.h>

    int
    DB_TXN->set_name(DB_TXN *txn, const char *name);

The `DB_TXN->set_name()` method associates the specified string with the transaction. The string is returned by DB_ENV->txn_stat() and displayed by DB_ENV->txn_stat_print().

If the database environment has been configured for logging and the Berkeley DB library was configured with --enable-diagnostic, a debugging log record is written including the transaction ID and the name.

The `DB_TXN->set_name()` method may be called at any time during the life of the application.

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

### Parameters

#### name

The name parameter is the string to associate with the transaction.

### Class

DB_ENV, DB_TXN

### See Also

Transaction Subsystem and Related Methods

Prev | Up | Next
DB_TXN->prepare() | Home | DB_TXN->set_priority()