Getting Started with Berkeley DB Java Edition

Legal Notice

This documentation is distributed under an open source license. You may review the terms of this license at: http://www.oracle.com/technology/software/products/berkeley-db/htdocs/jeoslicense.html

Oracle, Berkeley DB, Berkeley DB Java Edition and Sleepycat are trademarks or registered trademarks of Oracle. All rights to these marks are reserved. No third-party use is permitted without the express prior written consent of Oracle.

Java™ and all Java-based marks are a trademark or registered trademark of Sun Microsystems, Inc, in the United States and other countries.

To obtain a copy of this document's original source code, please submit a request to the Oracle Technology Network forum at: http://forums.oracle.com/forums/forum.jspa?forumID=273

11/9/2007


Table of Contents

Preface
Conventions Used in this Book
For More Information
1. Introduction to Berkeley DB Java Edition
Features
The JE Application
Databases and Database Environments
Database Records
Putting and Getting Database Records
Duplicate Data
Replacing and Deleting Entries
Secondary Databases
Transactions
JE Resources
Application Considerations
JE Backup and Restore
JCA Support
JMX Support
Getting and Using JE
JE Exceptions
Six Things Everyone Should Know about JE Log Files
2. Database Environments
Opening Database Environments
Closing Database Environments
Environment Properties
The EnvironmentConfig Class
EnvironmentMutableConfig
Environment Statistics
Database Environment Management Example
3. Databases
Opening Databases
Deferred Write Databases
Closing Databases
Database Properties
Administrative Methods
Database Example
4. Database Records
Using Database Records
Reading and Writing Database Records
Writing Records to the Database
Getting Records from the Database
Deleting Records
Data Persistence
Using the BIND APIs
Numerical and String Objects
Serializable Complex Objects
Custom Tuple Bindings
Using Comparators
Writing Comparators
Setting Comparators
Database Record Example
5. Using Cursors
Opening and Closing Cursors
Getting Records Using the Cursor
Searching for Records
Working with Duplicate Records
Putting Records Using Cursors
Deleting Records Using Cursors
Replacing Records Using Cursors
Cursor Example
6. Secondary Databases
Opening and Closing Secondary Databases
Implementing Key Creators
Secondary Database Properties
Reading Secondary Databases
Deleting Secondary Database Records
Using Secondary Cursors
Database Joins
Using Join Cursors
JoinCursor Properties
Secondary Database Example
Opening Secondary Databases with MyDbEnv
Using Secondary Databases with ExampleInventoryRead
7. Backing up and Restoring Berkeley DB Java Edition Applications
Databases and Log Files
Log File Overview
Cleaning the Log Files
The BTree
Database Modifications and Syncs
Normal Recovery
Performing Backups
Performing a Hot Backup
Performing an Offline Backup
Using the DbBackup Helper Class
Performing Catastrophic Recovery
Hot Standby
8. Administering Berkeley DB Java Edition Applications
The JE Properties File
Managing the Background Threads
The Cleaner Thread
The Checkpointer Thread
Sizing the Cache
The Command Line Tools
DbDump
DbLoad
DbVerify

List of Examples

2.1. Database Environment Management Class
3.1. Database Management with MyDbEnv
4.1. Inventory.java
4.2. Vendor.java
4.3. InventoryBinding.java
4.4. Stored Class Catalog Management with MyDbEnv
4.5. ExampleDatabasePut.java
5.1. ExampleInventoryRead.java
6.1. ItemNameKeyCreator.java
6.2. SecondaryDatabase Management with MyDbEnv
6.3. SecondaryDatabase usage with ExampleInventoryRead