Library Version 12.1.6.1

Db::set_errpfx()
Prev | Chapter 2. The Db Handle | Next

## Db::set_errpfx()

    #include <db_cxx.h>

    void Db::set_errpfx(const char *errpfx);

Set the prefix string that appears before error messages issued by Berkeley DB.

The `Db::set_errpfx()` and DbEnv::set_errpfx() methods do not copy the memory to which the errpfx parameter refers; rather, they maintain a reference to it. Although this allows applications to modify the error message prefix at any time (without repeatedly calling the interfaces), it means the memory must be maintained until the handle is closed.

For Db handles opened inside of Berkeley DB environments, calling the `Db::set_errpfx()` method affects the entire environment and is equivalent to calling the DbEnv::set_errpfx() method.

The `Db::set_errpfx()` method configures operations performed using the specified Db handle, not all operations performed on the underlying database.

The `Db::set_errpfx()` method may be called at any time during the life of the application.

### Parameters

#### errpfx

The errpfx parameter is the application-specified error prefix for additional error messages.

### Class

Db

### See Also

Database and Related Methods

Prev | Up | Next
Db::set_error_stream() | Home | Db::set_feedback()