Table of Contents

Apache Derby

A tiny Java DB (2MB) deliered togehter with JDK.

install

set environment var DERBY_HOME

DERBY_HOME=d:\path\to\jdk8x64\db\

and add DERBY_HOME\bin to Path environment variable

start derby
$DERBY_HOME/bin/startNetworkServer
create Database

Start queriing tool ij

ij

Create DB by connecting to it with create=true

ij> connect 'jdbc:derby://localhost:1527/Chapter01DB;create=true';

Create customer Table

ij> create table customer (custId int primary key, firstname varchar(20), lastname varchar(20));

Print customer Table

ij> describe customer;

Insert stuff into customer Table

ij> insert into customer values (1, 'Fred', 'Chene'); 
ij> insert into customer values (2, 'Sylvain', 'Verin'); 
ij> insert into customer values (3, 'Robin', 'Riou');

Count stuff in customer Table

ij> select count(*) from customer;