Berkeley DB Java Edition Tutorial

table of Contents:

  • Outline
  • characteristic
  • download
  • reference

[I. Overview

Berkeley DB is a long history of embedded database system, in 2006 acquired by Oracle. Now we will see on the Oracle Web site: BerkeleyDB, BerkeleyDB XML and BerkeleyDB JAVA Edition The three stuff. Simply put BerkeleyDB is only the beginning of the C language version, but JAVA also be used, but need JNI calls, efficiency may be a bit affected. Later, the JAVA Edition, using pure JAVA realize again, that is what we see BerkeleyDB JAVA Edition (referred to as JE).

JE is a generic transaction protection, 100% pure Java (JE does not make any JNI calls) prepared by the embedded database. Therefore, it provides a safe and efficient storage and management of data for any Java developer.

You can use a series of Java API JE, the API can read and write data, manage your database, and can perform some more advanced activities such as management services. JE and interact Java API There are two basic forms. The first is a high-level API, which allows you to persistence of Java classes. The second is a low-level API, which provides additional flexibility and JE database.

Official website: http://www.oracle.com/technetwork/products/berkeleydb/overview/index.html

[Di], characteristic

  1. Support for large databases: the amount of data it supports from 1 to number one million, the database size limit is essentially limited by your hardware supports.
  2. Database Environment: Database Environment provides a package and a management unit or more databases. Database Environment is a unit of internal resource management, such as in-memory caching and background thread. Finally, use it to manage concurrency and transactions. Please note that all applications require the use of JE Database Environment.
  3. Multi-threaded, multi-process support: JE is designed to control multi-threaded design. Read and write operations can be multi-threaded. JE using record-level locking provides high concurrency for threaded applications. In addition, JE deadlock timeout detection using a mechanism to ensure that no two threads deadlock indefinitely. JE allows multiple processes to access the same DB, but in this case, Berkeley only allow one thread to write, random read operations.
  4. Transaction: Atomicity, recoverability, isolation.
  5. Memory Cache: To reduce the IO operations to improve performance, the data is temporarily stored in the memory inside.
  6. index.
  7. Log file: JE data is stored in one or more digital home directory named log file. A log file is written and very easy to transplant across platforms.
  8. Background thread: JE offers several internal thread management resources for you. checkpointer is responsible for the database to refresh the data on the disk; compressor threads removed from the database due to the sub-tree pruning activities was empty data; cleaner thread is responsible for clean up and delete unwanted log files to help you save disk space.
  9. Backup and recovery: JE backup is to copy log files to a secure storage medium, its reconstruction approach is to come up with log files to backup, put the original location, you can restart JE.

[Three], download

2012-08-22 As of the latest version 5.0.58, can be downloaded from the official website (need to register an account).

If Maven build the project, you can add the following content in POM.xml in:

 
  <</code>dependency>
  <</code>groupId>com.sleepycat</</code>groupId>
  <</code>artifactId>je</</code>artifactId>
  <</code>version>4.0.92</</code>version>
  <</code>type>jar</</code>type>
  <</code>scope>compile</</code>scope>
  </</code>dependency>

Currently the repository is updated to version 4.0.92

[Tetrakis], the reference

http://docs.oracle.com/cd/E17277_02/html/GettingStartedGuide/introduction.html

 

Published 74 original articles · won praise 337 · Views 1.3 million +

Guess you like

Origin blog.csdn.net/kebu12345678/article/details/104761161