วันศุกร์ที่ 3 กรกฎาคม พ.ศ. 2552

Derby Database Installation on ubuntu

Installation

1. download bin installation from derby's download page

2. set environment variable in /etc/environment
or ~/.bashrc or ~/.bash_aliase
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin

export DERBY_INSTALL=/mnt/disk/AIT/Quality/db-derby-10.5.1.1-bin // change this into your derby installation path
export CLASSPATH=$DERBY_INSTALL/lib/derby.jar:$DERBY_INSTALL/lib/derbytools.jar:.
3. run
$ cd $DERBY_INSTALL/bin
$ . setEmbeddedCP

and terminal will close, don't be panic. go on to next steps.

4. Testing if installation is correct

$ java org.apache.derby.tools.sysinfo

Result should be something like this.
------------------ Java Information ------------------
Java Version: 1.6.0_13
Java Vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-sun-1.6.0.13/jre
Java classpath: /mnt/disk/AIT/Quality/db-derby-10.5.1.1-bin/lib/derby.jar:/mnt/disk/AIT/Quality/db-derby-10.5.1.1-bin/lib/derbytools.jar:.
OS name: Linux
OS architecture: i386
OS version: 2.6.28-13-generic
Java user name: dsin
Java user home: /home/dsin
Java user dir: /mnt/disk/AIT/Quality/db-derby-10.5.1.1-bin/bin
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
--------- Derby Information --------
JRE - JDBC: Java SE 6 - JDBC 4.0
[/mnt/disk/AIT/Quality/db-derby-10.5.1.1-bin/lib/derby.jar] 10.5.1.1 - (764942)
[/mnt/disk/AIT/Quality/db-derby-10.5.1.1-bin/lib/derbytools.jar] 10.5.1.1 - (764942)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United States [en_US]]
Found support for locale: [cs]
...

ij basics


$ java org.apache.derby.tools.ij

create database
ij> connect 'jdbc:derby:MyDbTest;create=true';

it will create database at current path that contains 2 files (derby.log, and folder with the same name as database)

connect database
ij> connect 'jdbc:derby:MyDbTest';

exit
ij> exit;


ref : derby

ไม่มีความคิดเห็น:

LinkWithin

Related Posts Plugin for WordPress, Blogger...