Apache Derby is a relational database management system (RDBMS) engine that is developed on Java and SQL technology. It is the database engine that can be embedded with any Java application. Apache Derby maintains data integrity and supports a better data transaction. Derby comes with a database server hence a user need not worry about the server installation. The Derby database is portal and data can be moved from one machine to another machine.

Apache Derby is based on module architecture. A module is a discrete set of functionality such as lock manager, indexing method, etc. Its interface is defined by a set of Java interfaces.

There are four key areas of Apache Derby Architecture as mentioned in the below figure.

  1. JDBC
  2. SQL
  3. Store
  4. Services

create table hbase

Let us see each in detail.


1. JDBC

It is Derby API for applications that consist of implementations of the java.sql and javax.sql classes for JDBC 2.0 and 3.0. Derby is used by applications solely through their operations of the top-level JDBC interfaces such as Driver, DataSource, ConnectionPoolDataSource, and XADataSource.


2. SQL

SQL layer is divided into two main logical areas.

  1. Compilation
  2. Execution

Let us see each in detail.

1. Compilation

The compilation consists of a five-step process.

  • Using Javacc generated parser the parsing is done.
  • After this, the binding of the variable is done to resolve all object names.
  • Consider the best optimization to get the best path for execution.
  • The Java byte code is generated to show the statement plan.
  • The last step would be creating an instance by loading the class and represent the query state.

2. Execution

Execute method is called for SQL execution on the instance of the generated class that returns a result set object.


3. Store

The store layer is divided into two areas, access and row. The access layer sits on the top and provides the transaction management and transaction logging whereas the row layer is used to store the data file in the format of the Java filesystem.


4. Services

Services are the utility modules that are used for lock management, cache management, error logging, and so on.


Apache Derby - Deployment Modes

Apache Derby can be deployed in two modes, embedded mode, and client-server mode.


Embedded Mode

In Embedded mode an application accesses a Derby database using the Embedded Derby JDBC driver. If we deploy an embedded mode then the database engine will run in the same JVM as the Java application.


create table hbase


Client-Server Mode

In client-server mode, the derby will run in the JVM of the application server. For accessing data we would be sending a request to the server to process it. Client-server mode process requests from multiple applications.


create table hbase