DBDB.io The Encyclopedia of Database Systems · Est. 2017
Database of Databases

Database Entry

Derby


Derby is a lightweight relational database implemented completely in Java. Using the JDBC driver provided, Derby can be embedded in any Java applications.[05][06]

Source Code
https://github.com/apache/derby[02]
Country of Origin
US
Start Year
1997 [07]
Former Names
JBMS, Cloudscape, Java DB
Project Type
Open Source
Written in
Java
Supported Languages
Java
Operating System
All OS with Java VM
License
Apache v2

Database Entry

Derby


Derby is a lightweight relational database implemented completely in Java. Using the JDBC driver provided, Derby can be embedded in any Java applications.[05][06]

History[07]


In 1997, Cloudscape Inc., a start-up in Oakland, California, developed a database engine called JBMS, which was later renamed as Cloudscape. From 1999 to 2001, Cloudscape was acquired first by Informix Software, and by IBM, and its name was changed to IBM Cloudscape. In 2004, IBM contributed the code to the Apache Software Foundation as Derby. In 2005, Derby became a Apache DB subproject.

Checkpoints[08]


Derby implements ARIES with slight variance. It allows fuzzy checkpointing. However, unlike ARIES implementation, it does not store a dirty page list in checkpoint records. Instead, during checkpoint, Derby flushes all database pages to disk. The checkpoint control files contains "undoLWM" and "RedoLWM". "UndoLWM" is set as the the starting LSN of the oldest active transaction when checkpoint starts, and "RedoLWM" is the the current LSN of the checkpoint.

Concurrency Control[09]


There is no concurrency control logic implemented. It depends on the correct application logics to prevent deadlocks. Deadlock detection is implemented by Derby such that the transaction that holds the least number of locks will be aborted.

Data Model[01]


Foreign Keys[10]


Foreign key is implemented as one of the CONSTAINT clauses. There are two levels of CONSTAINTS, column level and table level. Foreign key constraint in a column level enforces that the values in the column must corresponds to the values in the referenced column marked as primary key or unique key. Table level constraint works similarly, but it is for multiple columns.

Insert, update or delete instructions will be rejected with a statement exception if the foreign key constraint is violated. The constraint check can be at statement execution or commit depending on the constraint mode. (IMMEDIATE or DEFERRED).

Indexes[11]


Derby implements standard B+ Tree algorithms. It stores keys in leaf pages only. The B+ Tree supports page-level latching. Derby uses exclusive latches, not shared latches.

Isolation Levels[12]


It supports all four level of isolations. Isolation levels only differ for SELECT statements. They behave the same for other operations.

Joins[13]


Derby provides two types of join strategies -- nested loop and hash join. Nested loop join is more preferable in most cases. Hash join is preferred when inner table values are unique and outer table have many qualifying rows. Also, when the system estimated that the amount of memory required for hash join exceeds the amount available, nested loop will be used.

Logging[14][11]


Derby implements a combination of physical and logical logging. For actions on the same page, it uses physical logging. For BTree operations, which might affect several pages, it uses physical redo and logical undo.

Query Interface[06]


SQL

Storage Architecture[15][16]


Derby mainly support on-disk database. It also provides in-memory database for testing and developing applications. Note that in-memory database do not show in the Derby system directories.

Storage Model


Storage Organization


Stored Procedures[17]


Derby supports prepared statements with parameter substitutions.

Views[18]


Derivative Systems
Splice Machine Splice Machine

Citations

18 sources
  1. Apache Derby apache.org
  2. GitHub - apache/derby: Mirror of Apache Derby · GitHub github.com
  3. Apache Derby: Documentation apache.org
  4. Apache Derby - Wikipedia wikipedia.org
  5. https://wiki.apache.org/db-derby/ apache.org Dead — Check Archive
  6. Apache Derby apache.org
  7. Apache Derby Project Charter apache.org
  8. Derby Logging and Recovery apache.org
  9. Derby Developer's Guide apache.org
  10. CONSTRAINT clause apache.org
  11. org.apache.derby.impl.store.access.btree apache.org
  12. Isolation levels and concurrency apache.org
  13. Join strategies apache.org
  14. Derby Logging and Recovery apache.org
  15. https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/getstartderby.pdf apache.org Dead — Check Archive
  16. https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/devguide/derbydev.pdf apache.org Dead — Check Archive
  17. Tuning Derby apache.org
  18. CREATE VIEW statement apache.org
Revision #26 Last Updated: