Skip to content

Derby

Apache Derby, the embedded Java database: the ij tool, connection URLs and common SQL tasks.

1 min read

References

Apache Derby

Connect to the database with ij

First run ij tool. The Derby ij tool is a JDBC tool that you can use to run scripts or interactive queries against a Derby database.

Terminal window
java -jar /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/db/lib/derbyrun.jar ij

or if ij is in your PATH (ex: /Applications/NetBeans/glassfish-4.1.1/javadb/bin)

Terminal window
java org.apache.derby.tools.ij

then connect to the database

Terminal window
ij> connect 'jdbc:derby://localhost:1527/sample;user=app;password=app';
ij> connect 'jdbc:derby:retailpos';
ij> connect 'jdbc:derby:memory:retailpos';
ij> connect 'jdbc:derby:/Users/dev/work/workspaces/retailpos/retailpos';

after connecting you can use sql commands.

Terminal window
ij> show tables;
ij> select * from customer;
ij> select * from product;

to exit from ij tools

Terminal window
ij> exit;

Related articles

1 min read

SQL

SQL joins explained — inner, left, right and full outer — with examples.

  • Databases
1 min read

Database Migration

Migrating a MySQL database to PostgreSQL with pgloader, step by step.

  • Databases
3 min read

Jakarta

Jakarta EE namespaces, project settings and what changed in Jakarta EE 10 and 11.

  • Java & Jakarta EE

Type to search the whole site.