Chapter 1. Introduction to Building Distributed Applications with Berkeley DB

Table of Contents

Berkeley DB Server
Supported Features
Client Driver APIs
Secure Connections

In addition to being an embedded database, DB also supports the client-server architecture by providing a stand-alone server program and client driver APIs. The server program offers remote access to DB features. The client driver APIs provide building blocks for applications that communicate with a database server. Multiple client applications can communicate with a single server simultaneously.

This book provides a thorough introduction and discussion on how to build distributed applications with Berkeley DB (DB). It describes the features supported by the server, and how to configure and start the server program. Finally, it describes the driver APIs that you use to implement client applications.

You should understand the concepts from the Berkeley DB Getting Started with Transaction Processing guide before reading this book.

Berkeley DB Server

The server is capable of managing multiple DB environments and databases on behalf of client applications. All environments and databases managed by a server are protected by transactions. Non-transactional environments or databases are not supported by the server. The server can serve multiple client applications simultaneously.

Not all features offered by the DB library are supported by the server. For example, features that require callback functions are not supported. An exception to this is secondary databases, where a callback function is needed to create the set of secondary keys corresponding to a given primary key and data pair.

To avoid leaking DB handles, the server can be configured to close long-inactive handles automatically. This is useful when client applications may disconnect unexpectedly. For example, a client application may open a transactional cursor, update a few records using the cursor and then disconnect unexpectedly (e.g. the client application crashes). Without the ability to close (e.g. abort) the transaction handle by the server, the transaction will be open forever, and the locks held by the transaction will never be released. This would block other client applications that require any of the locks.

Supported Features

The following high-level features are supported by Berkeley DB server:

  • B-Tree, Hash and Recno access methods
  • Transaction
  • In-memory databases
  • Secondary databases, foreign constraints and join cursors
  • Sequences
  • Environment and database statistics
  • Close long-inactive handles manually and automatically
  • SSL over TCP connections