Child pages
  • Executing SQL Commands Against the Embedded Derby Database
Skip to end of metadata
Go to start of metadata

This article provides step by step instructions to connect to Apache Derby database, using command line interface, that comes with Flux. The syntax provided is for Windows platform but the concept is same for Linux environment.

(1) Download Derby 10.12.1.2 release: (We should only download this version to match version with that shipped in Flux)

http://archive.apache.org/dist/db/derby/db-derby-10.1.1-/db-derby-10.12.1.1-bin.zip

  • Unzip the zip file

(2) Copy the following files into a new folder (for example, C:\Users\Administrator\Desktop\fluxderby)

  • derbyclient.jar
  • derby.jar
  • derbynet.jar
  • derbyrun.jar
  • derbytools.jar

(3) Set the following environment variables

  • SETX DERBY_HOME C:\Users\Administrator\Desktop\fluxderby
  • SETX CLASSPATH .;%DERBY_HOME%\*

(4) Close and re-open command line for new environment variables to be available

(5) Stop the Flux server to stop the already started Derby. In Flux, Derby is not started in server mode. That means that once Flux is started, the CLI would refuse to connect. It can only connect if Flux has been shut down.

(6) In command line type below command to run ij, the interactive SQL scripting tool

  • java org.apache.derby.tools.ij


(7) To connect to the Flux derby database use the below command. “c:/<Your Flux Installation Directory>/derbydb” is the full path to the Flux Derby database.

  • connect 'jdbc:derby:<Your Flux Installation Directory>/derbydb;create=false';

(8) After connecting, run your SQL commands, using the SA schema. For example;

  • SELECT COUNT(*) FROM SA.FLUX_AUDIT_TRAIL;
  • SELECT * FROM SA.FLUX_READY;
  • For help - enter help; and press enter from the command prompt.
  • To exit the command  - enter exit; and press enter from the command prompt.