How-to Quickstart with Oracle Java DB on Ubuntu 14.04 Trusty LTS Linux

January 14th, 2015 by thelinuxevangelist

Java DB Quickstart for Ubuntu Linux



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.

Oracle Java DB Quickstart on Ubuntu Linux - Featured
  1. How-to Install Oracle JDK with Java DB on Ubuntu:

    Oracle JDK 7/8 Installion for Ubuntu

    Set also the JAVA_HOME Environment Variable!

  2. Open a Command Line Terminal Shell Session
    Ctr+Alt+t
    (Press “Enter” to Execute Commands)

    Getting-Started with Java DB on Ubuntu Linux - Open Terminal
  3. Set up PATH and DERBY_HOME Environment Variable

    nano $HOME/.bashrc

    Append:

    export DERBY_HOME=$JAVA_HOME/db
    export PATH=$PATH:$DERBY_HOME/bin
    

    Ctrl+x to Save & Exit from ‘nano’ Editor ;)

    bash

    To Load the New Environment.

  4. Download Oracle Java SE JDK Demos and Samples for Linux:

    Oracle JDK7 Demos Samples tar.gz
  5. Double-Click and Extract into /tmp

    Getting-Started Java DB on Ubuntu Linux - Demos Extraction
    Or from Command Line:

    tar xvzf ~/Downloads/jdk*demos.tar.gz -C /tmp/
  6. Relocate JDK Demos & Samples

    mv /tmp/jdk*/demo /tmp/jdk*/sample $JAVA_HOME/
  7. Set the Derby Demo Environment

    mkdir ~/derbyDemo
    cd ~/derbyDemo
    cp $JAVA_HOME/demo/db/programs/toursdb/*.sql .
  8. Running Derby CLI ij Tool

    java -jar $DERBY_HOME/lib/derbyrun.jar ij
  9. Open Connection and Create a DB using JDBC Driver

    CONNECT 'jdbc:derby:mydb;create=true';
  10. 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;
  11. 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
  12. Oracle Java DB Online Documentation:

    Oracle Derby DB Docs
Share on Tumblr

Tags: , , , , , , , , , , , , , ,


Comments are disabled