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 release: (We should only download this version to match version with that shipped in Flux)

  • 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

(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

(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;

  • For help - enter help; and press enter from the command prompt.
  • To exit the command  - enter exit; and press enter from the command prompt.