What is Apache Derby Database?
Apache Derby database is a collection of an object such as tables, columns, indexes, jar files, and its configurations. It is stored in files that live in a directory of the same name as the database. The DB directories are present under the system directories.
A Derby database directory contains the following files and directories used by the software.
1. log directory
Log directory contains the files that make up the database transaction log, used internally for data recovery. It is not the same as the error log.
2. seg0 directory
This directory will have a file each for the system table, user table, an index table.
3. service.properties file
This file contains internal configuration information.
4. tmp directory
A temporary directory is used by Derby for large sorts and deferred updates and deletes SQL queries. For databases on read-only media, we might need to set a property to change the location of this directory.
5. jar directory
Jar directories are used to store jar files which are used when we use database class loading.
Apache Derby Database Creation
Derby database can be created using the below commands.
We will create a database name “EMPDB” and for that first, we will start Derby in embedded mode using the “setEmbeddedCP” command and then the “ij” tool to run queries.
Command
cloudduggu@ubuntu:~/derby$ ./bin/setEmbeddedCP
cloudduggu@ubuntu:~/derby$ ./bin/ij
ij> CONNECT 'jdbc:derby:EMPDB;create=true';
Output
Verify
Apache Derby Database Limitations
Apache Derby Database Limitations
Apache Derby databases have the following limitations.
- Apache Derby, the columns which are defined as CLOB, BLOB, and LONG VARCHAR data types are not supported for index.
- If the database space is exhausted and space is extending then, in that case, the system will get down.