Derby Command Line Quick Start

While you can find this information on the derby website, in a grossly large Derby Basics document, isn’t it nicer to just copy and paste? I just don’t understand why developers like to write documents that make you take so much time to get started.

wget http://apache.mirror.gtcomm.net//db/derby/db-derby-10.11.1.1/db-derby-10.11.1.1-bin.tar.gz
tar -xvzf db-derby-10.11.1.1-bin.tar.gz
sudo mv db-derby-10.11.1.1-bin /usr/local/
export DERBY_INSTALL=/usr/local/db-derby-10.11.1.1-bin
export CLASSPATH=$DERBY_INSTALL/lib/derby.jar:$DERBY_INSTALL/lib/derbytools.jar:.
 
java org.apache.derby.tools.ij

Once you’re in, you can issue the following commands…

connect 'jdbc:derby:MyDbTest;create=true';
drop table derbyDB;
create table derbyDB(num int, addr varchar(40));
insert into derbyDB values (1956,'Webster St.');
insert into derbyDB values (1910,'Union St.');
update derbyDB set num=180, addr='Grand Ave.' where num=1956;
select * from derbyDb;