Install Apache Derby and Configure Gradle - rsanchez-wsu/RaiderPlanner GitHub Wiki

Introduction

The goal for our system is to create an embedded, small-scale relational database. Most Database Management Systems require a connection to a server or some external system to host the database system; however, having such a large scale DBMS is not currently needed for our application. Therefore our development team is decided to use Apache Derby.

Apache Derby is an open source relational database that is entirely implemented in Java and embeds neatly into almost every Java program. Moreover, Apache Derby has an extremely tiny footprint -- about 3.5 megabytes. With, this DBMS our Raider Planner application will be able to run JDBC server frameworks, all within the same JVM, and on one single process. This DBMS is ideally suited for our application.


#1) Installation Apache Derby In order to install Apache Derby you must have Java Development Kit (JDK) and the Apache Derby software.

Java Development Kit

Note: Derby Needs Java 2 Standard Edition 8 or higher and only the JRE is required to launch the application. However, since our application is Java System you will definitely need the JDK. Therefore, make sure that you already have the JDK installed and verify your configuration settings before moving to the next section.

JDK Configurations To Check

Window: C:\> set JAVA_HOME=C:\jdk1.8 || UNIX Korn Shell: $ export JAVA_HOME=/opt/jdk1.8

Windows: C:\> set PATH=%PATH%;%JAVA_HOME%\bin || UNIX Korn Shell: $ export PATH=$JAVA_HOME/bin:$PATH

Verify Java:

java -version

java version "x.x.x_xx"

Java(TM) SE Runtime Environment (build xxxxxxxxx)

Java HotSpot(TM) 64-Bit Server VM (xxxxxxxxxxxxxxxxx)

Download Derby

You can download Apache Derby from the following site


Install Database

Create a folder for where you will put the installed Apache Derby. At the end of the process you will have a subdirectory called db-derby-10.14.1.0-bin. Note: we want to make sure to install the embedded Derby Driver not the full client driver.

Windows: C:\>mmkdir C:\Apache

Windows: C:\> mmkdir copy db-derby-10.14.1.0-bin.zip

Windows: C:\> mmkdir C:\Apache cd

C:\Apache unzip db-derby-10.14.1.0-bin.zip

Windows: C:\> set DERBY_INSTALL=C:\Apache\db-derby-10.14.1.0-bin

Next is important to create the classpath for JAR file:

Windows: C:\> set CLASSPATH=%DERBY_INSTALL%\lib\derby.jar;%DERBY_INSTALL%\lib\derbytools.jar

Windows: C:\> cd %DERBY_INSTALL%\bin C:\Apache\db-derby-10.14.1.0-bin\bin> setEmbeddedCP.bat

Check that the installation worked by running sysinfo command:

java org.apache.derby.tools.sysinfo

If you do not receive any error messages your installation was successful.


To see a more thorough example on how to install Apache Derby visit the following site


#2) Set up Gradle Edit Gradle.Build file. In particular, add appropriate dependency org.apache.derby:derby. This allows us to use the Derby embedded driver. This driver comes with the full derby package and should include the Derby database itself; however it does not come with in derbyclient.

    repositories {
	    mavenLocal()
	    mavenCentral()
	}
	dependencies {
	    compile group: 'org.apache.derby', name: 'derby', version: '10.14.1.0'
	}

If you run into any problems see the following link for more Information