The Official Berkeley DB Documentation from the creators, Sleepycat Software!
Table of Contents
I. REFERENCE GUIDE. 1. Introduction.
Mapping the Terrain: Theory and Practice. What Is Berkeley DB? What Is Berkeley DB Not? Do You Need Berkeley DB? What Other Services Does Berkeley DB Provide? What Does the Berkeley DB Distribution Include? Where Does Berkeley DB Run? Sleepycat Software's Berkeley DB Products.2. Getting Started: A Simple Tutorial.
Key/Data Pairs. Object Handles. Error Returns. Opening a Database. Adding Elements to a Database. Retrieving Elements from a Database. Removing Elements from a Database. Closing a Database.3. Access Method Configuration.
Selecting an Access Method. Logical Record Numbers. Selecting a Page Size. Selecting a Cache Size. Selecting a Byte Order. Non-Local Memory Allocation. Btree Comparison. Btree Prefix Comparison. Minimum Keys Per Page. Retrieving Btree Records by Number. Page Fill Factor. Specifying a Database Hash. Hash Table Size. Managing Record-Based Databases. Selecting a Queue Extent Size. Flat-Text Backing Files. Logically Renumbering Records. Opening a Database.4. Access Method Operations.
Opening Multiple Databases in a Single File. Upgrading Databases. Retrieving Records. Storing Records. Deleting Records. Flushing the Database Cache. Database Statistics. Closing a Database. Database Cursors. Retrieving Records with a Cursor. Storing Records with a Cursor. Deleting Records with a Cursor. Duplicating a Cursor. Logical Join. Data Item Count. Closing a Cursor. Cursor Stability. Database Verification and Salvage. Retrieved Key/Data Permanence for C/C++. Error Support.5. Access Method Wrap-Up.
Database Limits. Disk Space Requirements. Partial Record Storage and Retrieval.6. Berkeley DB Architecture.
Programming Model. Programmatic APIs. Scripting Languages. Supporting Utilities.7. Berkeley DB Environment.
Creating a Database Environment. File Naming. Filename Resolution in Berkeley DB. Security. Shared Memory Regions. Remote Filesystems. Opening Databases Within the Environment. Error Support.8. Berkeley DB Concurrent Data Store Applications. 9. Berkeley DB Transactional Data Store Applications.
Why Transactions? Terminology. Application Structure. Opening the Environment. Opening the Databases. Recoverability and Deadlock Avoidance. Atomicity. Repeatable Reads. Transactional Cursors. Nested Transactions. Environment Infrastructure. Deadlock Detection. Performing Checkpoints. Database and Log File Archival Procedures. Log File Removal. Recovery Procedures. Recovery and Filesystem Operations. Berkeley DB Recoverability. Transaction Throughput.10. XA Resource Manager.
Configuring Berkeley DB with the Tuxedo System. Frequently Asked Questions.11. Programmer Notes.
Error Returns to Applications. Environmental Variables. Building Multithreaded Applications. Berkeley DB Handles. Name Spaces. Library Version Information. Compatibility with Historic UNIX Interfaces. Recovery Implementation. Application-Specific Logging and Recovery. Run-Time Configuration.12. The Locking Subsystem.
Page Locks. Standard Lock Modes. Locking Without Transactions. Locking with Transactions: Two-Phase Locking. Access Method Locking Conventions. Berkeley DB Concurrent Data Store Locking Conventions. Deadlocks and Deadlock Avoidance. Configuring Locking. Locking and Non-Berkeley DB Applications.13. The Logging Subsystem.
Configuring Logging. Log File Limits.14. The Memory Pool Subsystem.
Configuring the Memory Pool.15. The Transaction Subsystem.
Transaction Limits. Configuring Transactions. Transactions and Non-Berkeley DB Applications.16. RPC/Client Server.
Client Program. Server Program.17. Java API.
Compatibility. Java Programming Notes. Java FAQ. Loading Berkeley DB with Tcl.18. Tcl API.
Using Berkeley DB with Tcl. Tcl API Programming Notes. Tcl Error Handling. Tcl FAQ. The db_dump and db_load Utilities.19. Dumping and Reloading Databases.
Dump Output Formats. Loading Text into Databases.20. Debugging Applications.
Compile- time Configuration. Run-time Error Information. Reviewing Berkeley DB Log Files. Common Errors. Building for UNIX.21. Building Berkeley DB for UNIX and QNX Systems.
Configuring Berkeley DB. Changing Compile or Load Options. Installing Berkeley DB. Dynamic Shared Libraries. Running the Test Suite Under UNIX. Architecture-Independent FAQs. AIX. FreeBSD. HP-UX. IRIX. Linux. OSF/1. SCO. Solaris. SunOS. Ultrix. Building for Win32.22. Building Berkeley DB for Win32 Platforms.
Running the Test Suite Under Windows. Windows Notes. Windows FAQ.23. Building Berkeley DB for VxWorks Systems.
VxWorks Notes. VxWorks FAQ. Upgrading Berkeley DB Installations.24. Upgrading Berkeley DB Applications.
Running the Test Suite.25. Test Suite.
Test Suite FAQ.26. Distribution.
Technical Papers on Berkeley DB.27. Additional References.
Background on Berkeley DB Features. Database Systems Theory.
II. API MANUAL. 28. C API. 29. C++ API. 30. Java API. 31. Tcl API. 32. Supporting Utilities.
Small, special-purpose computing devices and high-end core Internet servers need fast, reliable database management. Berkeley DB is an embedded database that provides high-performance, scalable, transaction-protected and recoverable data management services to applications. Extremely portable, this library runs under almost all UNIX and Windows variants, as well as a number of embedded, real-time operating systems.
Berkeley DB is the ultimate resource for the world's most widely deployed embedded database engine. This book will aid software architects and engineers, product managers, and systems and network administrators without the overhead imposed by other database products.
Designed by programmers for programmers, this classic library style toolkit provides a broad base of functionality to application writers. This book will help you to make intelligent choices about when and how to use Berkeley DB to meet your needs.
You can visit the Sleepycat website to get the latest errata for this book.
NOTE: The first printing of this book contained an error in the table of contents that caused the page numbers to be off. This will be corrected in the second printing. If you have an earlier edition, you can download a pdf of the correct table of contents that you can print out and use with your book. If you have any questions, please feel free to contact the editor of this book at firstname.lastname@example.org.
Sleepycat Software, Inc. develops, and supports Berkeley DB. Berkeley DB was originally written by Keith Bostic, Mike Olson, Margo Seltzer, and Ozan Yigit in the early 1990s. Keith Bostic, one of the principal developers of the University of California's 4.4BSD UNIX releases, approached Seltzer and Yigit to write an Open Source implementation of the UNIX C library dbm hash package for inclusion in 4.4BSD. They agreed, and created a general-purpose hashing library. Later, Bostic enlisted Olson to add a Btree access method to the package. These two projects were integrated and became the first Berkeley DB release, which was included in the 4.4BSD UNIX and related Net/2 releases.
In the years that followed, Berkeley DB was adopted by an enormous number of both proprietary and Open Source projects. Its high performance, ready availability, and easy-to-use interfaces made it a natural tool for a wide variety of applications.
In 1996, there were enough commercial users of the software to justify the formation of a company to enhance and support it. Bostic and Seltzer formed Sleepycat Software to do this. They spent a year adding critical features to the academic code (most notably, transactions, support for concurrent users, and recoverability), and version 2.0 of Berkeley DB was released by Sleepycat Software in 1997.
Since that initial release, Berkeley DB has been deployed in network switches, email clients, wireless communication systems, mission-critical site-monitoring software, and many other applications.
Sleepycat is an Open Source company, and it is committed to the development and distribution of Berkeley DB as an Open Source product. Sleepycat's license for Berkeley DB permits its use at no charge in Open Source applications.