Java DB Quickstart for Ubuntu
The Linked Guide shows you How to Install and Getting-Started with the Oracle Java DB on Ubuntu 14.04 Trusty LTS i386/amd64 Linux.
The Oracle Java Derby DB is Included in the Oracle Java SE JDK 7/8 and So you will find Link to Installing the Oracle JDK on Ubuntu Linux.
-
How to Download and Install Oracle JDK with Java DB on Ubuntu
Set also the JAVA_HOME Environment Variable!
-
Open a Command Line Terminal Shell Session
Ctrl+Alt+t
(Press “Enter” to Execute Commands)In case first see: Terminal QuickStart Guide.
-
Set up PATH and DERBY_HOME Environment Variable.
nano $HOME/.bashrc
Append:
export DERBY_HOME=$JAVA_HOME/db/nexport PATH=$PATH:$DERBY_HOME/bin
Ctrl+x to Save & Exit from ‘nano’ Editor ;)
bash
To Load the New Environment.
-
Download Oracle Java SE JDK Demos and Samples for Linux
-
Double-Click and Extract into /tmp.
Or from Command Line:tar xvzf ~/Downloads/jdk*demos.tar.gz -C /tmp/
-
Relocate JDK Demos & Samples.
mv /tmp/jdk*/demo /tmp/jdk*/sample $JAVA_HOME/
-
Set the Derby Demo Environment.
mkdir ~/derbyDemo
cd ~/derbyDemo
cp $JAVA_HOME/demo/db/programs/toursdb/*.sql .
-
Running Derby CLI ij Tool.
java -jar $DERBY_HOME/lib/derbyrun.jar ij
-
Open Connection and Create a DB using JDBC Driver.
CONNECT 'jdbc:derby:mydb;create=true';
-
Create Table and Insert Records.
CREATE TABLE MYTABLE (ID INT PRIMARY KEY, NAME VARCHAR(12));
INSERT INTO MYTABLE VALUES (1,'ALAN'),(20,'JACQUES'),(300,'MARIO');
Show up the Inserted Values:
SELECT * FROM MYTABLE;
-
Loading Tables and Records from SQL Scripts.
run 'ToursDB_schema.sql';
Populate the Tables with data:
run 'loadTables.sql';
Show up some Inserted Stuff:
SELECT * FROM FLIGHTS
-
Oracle Java DB Online Documentation