Library Version 12.1.6.2

Multi-Threaded Applications
Prev | Chapter 3. Berkeley DB Client Driver APIs |

## Multi-Threaded Applications

The `BdbServerConnection` class is not thread-safe. Furthermore, objects created from a `BdbServerConnection` instance use the connection object internally for remote invocations. Therefore, they are not thread-safe either. The connection object together with all objects created from it must be used in a single thread, because they all share the same connection object. For example, if we create a `BdbServerAdmin` object, a `SEnvironment` object from a `BdbServerConnection` object, a `SDatabase` object, and a `STransaction` object from the `SEnvironment` object, all five objects must be accessed in a single thread.

For a multi-threaded application, you can create multiple instances of `BdbServerConnection` each in a separate thread. Then, if necessary, you can open the same environment or database from multiple connections to access the same environment or database concurrently.

Prev | Up |
Secondary Databases | Home |