Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Apache Derby Database - Tutorial

Lars Vogel

Version 0.5

10.09.2010

Revision History
Revision 0.110.01.2009Lars Vogel
Created
Revision 0.2 - 0.519.01.2009 - 10.09.2010Lars Vogel
bug fixes and enhancements

Apache Derby

This articles explains how to install the Apache Derby database, how to start the Derby server, how to connect via Java to Derby and how to use the Derby command line tool to issue SQL statements. The installation of Apache Derby as Windows Service is also explained.


Table of Contents

1. Apache Derby
1.1. Overview
1.2. Server vrs. embedded mode
2. Installation of Derby
3. Server mode
3.1. Starting Derby in server mode
3.2. Connect to the Derby Server via Java
4. Derby tools
4.1. Using Derby from the command line (ij)
4.2. SQL dump for the database schema
5. Running Derby Server as Windows Service
6. Thank you
7. Questions and Discussion
8. Links and Literature

1. Apache Derby

1.1. Overview

Apache Derby is an open source database written in Java. It is free and performs well. Apache Derby is used in the JDK and is called Java DB. Apache Derby and Java DB are essentially the same. Apache Derby is the reference implementation for JDBC 4.0 and compatible to ANSI-SQL. JDBC is the Java interface to connect to databases.

1.2. Server vrs. embedded mode

Derby can be used in a server mode and in so-called embedded mode. If Derby runs in the server mode you start the Derby network server which will be responsible for handling the database requests. In the enbedded mode Derby Derby runs within the JVM (Java Virtual Machine) of the application. In this mode only the application can access the database, e.g. another user / application will not be able to access the database.