How to connect to a Derby DB and run different queries?

Maayan Amrani
2020-02-24 09:47


Connecting and running queries on Derby DB


In order to run queries against Derby DB, we need to first connect to the DB by running the derbyrun.jar file:
$ java -jar Path_To_derbyrun.jar ij
(you may use the ‘find’ command to locate the derbyrun file, for example: $ find / -type f -name derbyrun.jar)

We would expect to see the following output:
ij version 10.11

Once there, we will run the following command in order to connect to the db:
ij> connect ‘jdbc:derby:/var/opt/jfrog/artifactory/data/derby;create=true’;

Afterwards, we will be able to run query. For instance, running a simple ‘select’ by:
ij> select * from access_users;