Getting Started with Transactional Data Store Applications

  • Opening the Environment

    Use DB_ENV->open() to initialize the database environment. Once the application has called DB_ENV->open(), it opens its databases within the environment. The application then makes changes to the databases inside of transactions. Note that the databases accessed by a transaction must not be closed during the transaction.

    Once all outstanding transactions are finished, all open Berkeley DB files should be closed. After that the environment should be closed by calling DB_ENV->close(). For more information, see Opening the environment.

  • Opening the Databases

    For information on opening databases in the database environment, see Opening the databases.

  • Using a Transaction

    There are a number of reasons to include transactional support in your applications. The most common ones are the following:

  • Using Transactional Cursor

    Berkeley DB cursors may be used inside a transaction, just like any other database method. The enclosing transaction ID must be specified when the cursor is created, but it does not need to be further specified on operations performed using the cursor. Note that a cursor must be closed before the enclosing transaction is committed or aborted. For more information, see Transactional cursors.