Oracle Berkeley DB Java Edition

Oracle Berkeley DB Java Edition is an open source, embeddable, transactional storage engine written entirely in Java. It takes full advantage of the Java environment to simplify development and deployment. The architecture of Oracle Berkeley DB Java Edition supports very high performance and concurrency for both read-intensive and write-intensive workloads. Depending on your needs choose between Berkeley DB Java Edition's Direct Persistence Layer (DPL), Persistent Collections API, or simply store key/value pairs of arbitrary data. If your application requires something outside the bounds of relational databases then Berkeley DB Java Edition is likely to be the best choice.

The majority of Java solutions use object-to-relational (ORM) solutions like the Java Persistence API (JPA) to map class and instance data into rows and columns in a RDBMS. Relational databases are well suited to data storage and analysis, however most persisted object data is never analyzed using ad-hoc SQL queries; it is usually simply retrieved and reconstituted as Java objects. Are you using ORM simply because it's there, or because you really need the features of SQL? The value of relational storage is lost on this basic task of object storage and retrieval. Berkeley DB Java Edition is different. Berkeley DB stores object graphs, objects in collections, or simple binary key/value data directly in an a btree on disk. This simple, highly efficient approach removes all the unnecessary overhead in ORM solutions. Using the Direct Persistence Layer (DPL) Java developers annotate classes with storage information, much like JPA. This approach is familiar, efficient, and fast. The DPL reduces the complexity of data storage while not sacrificing speed.

Berkeley DB Java Edition is different from all other Java databases available today. Berkeley DB Java Edition is not a relational engine built in Java. It is a Berkeley DB-style embedded store, with an interface designed for programmers, not DBAs. The architecture is based on a log-based, no-overwrite storage system, enabling high concurrency and speed while providing ACID transactions and record-level locking. Berkeley DB Java Edition efficiently caches most commonly used data in memory, without exceeding application-specified limits. In this way Berkeley DB Java Edition works with an application to use available JVM resources while providing access to very large data sets.

Berkeley DB Java Edition fits into the J2EE architecture by implementing three key APIs within J2EE. The Java Transaction API (JTA) enables Berkeley DB Java Edition to function as a managed transactional resource within an application server. Berkeley DB Java Edition also implements the J2EE Connector Architecture (JCA) to ease integration into application servers. Finally, once integrated and performing transactional operations, most applications will require some ability to manage a service. Berkeley DB Java Edition exports information and services using the Java Management Extensions (JMX). In concert JTA, JCA and JMX allow Berkeley DB Java Edition to operate to its fullest and in a predictable manner in J2EE-based solutions.

Berkeley DB Java Edition supports replication over multiple systems, enabling applications to scale massively with low latency and provide fault tolerance for high availability solutions. This technique works by having all updates go to a designated master, which distributes changes automatically to a set of replicas. The read workload can be spread across the replicas, and new replicas can join the group at any time to scale the system. If any replica fails, the remaining replicas can take over for it. If a master node fails, the replicas will hold an election and designate a new master. Once the new master has been chosen, all of the replicas synchronize with it and move forward with normal processing with no interruption in service. The master-failover process generally takes only a fraction of a second and read-requests can be serviced by replicas during that fail-over period ensuring zero downtime.

Data Storage

Berkeley DB Java Edition stores data quickly and easily without much of the overhead found in other databases. Berkeley DB Java Edition is a single JAR file that runs in the same JVM as your application, so there is no remote server. A local cache keeps the most active data in memory, avoiding costly disk access, and bounds the usage of JVM memory to a predictable amount.

  • Local, in-process data storage
  • Schema-neutral, application native data storage
  • Keyed and sequential data retrieval
  • Easy-to-use Java Collections API
  • Direct Persistence Layer (DPL) for accessing Java objects
  • Schema evolution of DPL classes
  • Single process, multi-threading model
  • Record level locking for high concurrency
  • Support for secondary indexes
  • In-memory, on disk or both
  • Configurable background cleaner threads re-organize data and optimize disk use

Berkeley DB Java Edition stores data reliably and ensures data integrity. In the event of a system failure, Berkeley DB Java Edition will recover transactional data and reset the system to a functional and consistent state from log and database information.

  • Full ACID compliance
  • Selectable isolation levels and durability guarantees, configurable on a per-transaction basis
  • Managed transactions using the Java Transaction API (JTA)
  • J2EE application server integration using J2EE Connector Architecture(JCA)
  • Auditing, monitoring, and administration using the Java Management Extensions (JMX)
  • Catastrophic and routine failure recovery modes
  • Timeout based deadlock detection
  • Hot and cold backups, log file compaction, and full database dumps

Berkeley DB Java Edition is highly portable, very flexible and easy to integrate. It was designed from day one as a pure Java product taking full advantage of the Java environment. As a single Java Archive (JAR) file, it runs within the JVM running your application. Berkeley DB Java Edition was designed to serve the large and growing Java community with a enterprise-grade, pure Java, data storage solution.

  • 100% pure Java for portability and ease of development
  • Single JAR file - easy to install, runs in the same JVM as the application
  • Java 1.5 or later Standard Edition JVM required
  • Programmatic administration and management
  • Zero human administration
  • API for routine administrative functions
  • Small footprint 820KB
  • Scalable to terabytes of data, millions of records
  • Source code, test suite included

Product Information
 Data sheet: Oracle Berkeley DB Java Edition (PDF)
 Quotes: What customers are saying about Berkeley DB Java Edition
 White paper: Berkeley DB Java Edition High Availability (HA) (English) (Chinese) (PDF)
 White paper: Oracle Berkeley DB Java Edition High Availability -Large Configuration and Scalability Testing (PDF)
 White paper: Write Forwarding Using Java RMI (PDF)
 White paper: Berkeley DB Java Edition Architecture (PDF)
 White paper: Direct Persistence Layer for Berkeley DB Java Edition (English) (Chinese) (PDF)
 White paper: Oracle Berkeley DB Java Edition vs. Apache Derby: A Performance Comparison (PDF)

Technical Resources
 Blog Post: How to configure Oracle Berkeley DB Java Edition for use on Google Android devices
 White Paper: Performing Queries in Oracle Berkeley DB Java Edition: a paper that demonstrates how to rewrite SQL using the Direct Persistence Layer (DPL) (Aug 2008)
 Article: Dynamo: Amazon's Highly Available Key-Value Store, All Things Distributed (Oct 2007)
 Article: Embedded Java Persistence ( English) ( Chinese - PDF), Oracle Magazine (March/April 2007)
 Documentation: Berkeley DB Java Edition
 FAQ: Berkeley DB Java Edition
 Article: Oracle Berkeley DB Java Edition 3.1.0: Direct Persistence Layer, The Server Side (October 2006)
 Article: High-Performance Data Management in Java, Dr. Dobb’s Journal (May 2005)
 Article: Using Berkeley DB Java Edition as a Persistence Manager for the Google Web Toolkit, OTN (Feb 2008)
 Presentation: Design and Implementation of a Transactional Data Manager, JavaOne 2004 (PDF)
 Discussion forum: Berkeley DB Java Edition