Berkeley DB Reference Guide:
RPC Client/Server

PrevRefNext

Introduction

Berkeley DB includes a basic implementation of a client-server protocol, using Sun Microsystem's Remote Procedure Call Protocol. RPC support is only available for UNIX systems, and is not included in the Berkeley DB library by default, but must be enabled during configuration. See Configuring Berkeley DB for more information. For more information on RPC itself, see your UNIX system documentation or RPC: Remote Procedure Call Protocol Specification, RFC1832, Sun Microsystems, Inc., USC-ISI.

Using the RPC mechanisms in Berkeley DB involves two basic steps:

  1. Modify your Berkeley DB application to act as a client and call the RPC server.
  2. Run the berkeley_db_svc server program on the system where the database resides.

Only some of the complete Berkeley DB functionality is available when using RPC. The following functionality is available:

  1. The db_env_create interface and the DB_ENV handle methods.
  2. The db_create interface and the DB handle methods.
  3. The txn_begin, txn_commit and txn_abort interfaces.

Note, however, the RPC client/server code does not support any of the user-defined comparison or allocation functions, e.g., an application using the RPC support may not specify its own Btree comparison function. All database method calls with a user-defined function as an argument must set the argument to NULL and specify the default.

If your application only requires those portions of Berkeley DB, then using RPC is fairly simple. If your application requires other Berkeley DB functionality, such as direct access to locking, logging or shared memory buffer memory pools, then your application cannot use the RPC support.

The Berkeley DB RPC support does not provide any security or authentication of any kind. Sites needing any kind of data security measures must modify the client and server code to provide whatever level of security they require.

One particularly interesting use of the RPC support is for debugging Berkeley DB applications. The seamless nature of the interface means that with very minor application code changes, an application can run outside of the Berkeley DB address space, making it far easier to track down many types of errors such as memory misuse.

PrevRefNext

Copyright Sleepycat Software