Apache Derby is a Relational Database Management System which is fully based on (written/implemented in) Java programming language. It is an open source database developed by Apache Software Foundation.
Audience
This tutorial is prepared for beginners to help them understand the basic concepts related to Apache Derby. This tutorial will give you enough understanding on the various SQL queries of Apache along with JDBC examples.
Prerequisites
Before you start practicing with various types of examples given in this tutorial, I am assuming that you are already aware about what a database is, especially the RDBMS and what is a computer programming language.
Introduction
Apache Derby is a Relational Database Management System which is fully based on (written/implemented in) Java programming language. It is an open source database developed by Apache Software Foundation.
Oracle released the equivalent of Apache Derby with the name JavaDB.
Features of Apache Derby
Following are the notable features of Derby database −
- Platform independent − Derby uses on-disc database format where the databases in it are stored in a file in the disc within the directory with the same name as the database.
- No modifying data − Because of this, you can move derby databases to other machines without modifying the data.
- Transactional support − Derby provides complete support for transactions ensuring data integrity.
- Including databases − You can include pre-build/existing databases into your current derby applications.
- Less space − Derby database has a small footprint, i.e., it occupies less space and it is easy to use and deploy it.
- Embed with Java Application − Derby provides an embedded database engine which can be embedded in to Java applications and it will be run in the same JVM as the application. Simply loading the driver starts the database and it stops with the applications.
Limitations of Apache Derby
Following are the limitations of Apache Derby −
- Derby does not support indexes for datatypes such as BLOB and LONGVARCHAR.
- If Derby does not have enough disc space, it will shut down immediately.
Data storage
While storing data, Apache Derby follows a concept known as conglomerate. In this, data of a table will be stored in a separate file. In the same way, each index of a table is also stored in a separate file. Thus, there will be a separate file for every table or index in the database.
Apache Derby Library/Components
Apache Derby distribution provides various components. In the lib folder of the apache distribution you have downloaded, you can observe jar files representing various components.
Jar file | Component | Description |
---|---|---|
derby.jar | Database Engine and JDBC driver | The Database engine of Apache Derby is an embedded relational database engine which supports JDBC and SQL API’s.This also acts as embedded Driver, using which you can communicate to Derby using Java applications. |
derbynet.jar derbyrun.jar | Network server | The Network Sever of Apache Derby provides the client server functionality, where the clients can connect to the Derby server through a network. |
derbyclient.jar | Network client JDBC driver | |
derbytools.jar | Command line tools | This jar file holds tools such as sysinfo, ij, and dblook. |
derbyoptionaltools.jar | Optional command line utilities (tools) | This jar file provides optional tools: databaseMetaData optional tool, foreignViews optional tool, luceneSupport optional tool, rawDBReader optional tool, simpleJson optional tool, etc |
derbyLocale_XX.jar | Jar files to localize messages | In addition to the above mentioned jar files, you can see several derbyLocale_XX.jar (es, fr, hu, it, ja, etc.). Using these, you can localize the messages of Apache Derby. |