» Accessing HSQLDB from Eclipse
These tutorials are no longer maintained. Some of these tutorials continue to be maintained for the lecture Advanced Concepts in Software Engineering.

Preconditions

Creating a Database Connection for In-Process HSQLDB

  1. Open the “Data Source Explorer” view using Window > Show view > Other and create a new Database Connection.
  2. Choose HSQLDB from the list of Connection Profile Types and provide a name, e.g. Library.
  3. Next, add a New Driver Definition and specify hsqldb.jar in the JAR List tab.

    Add new driver definition

  4. Enter the database name and specify the location of the database files, e.g. file:/tmp/wildfly/standalone/data/hypersonic/localDB.

Creating a Database Connection for Dedicated HSQLDB

  1. Start a dedicated instance by executing the following on a shell: java -cp ~/Downloads/hsqldb.jar org.hsqldb.server.Server --database.0 file:localDB --dbname.0 localDB
    • Adjust Java’s classpath (-cp) to match the location of hsqldb.jar on your system
    • database.0: the location where the database is stored
    • dbname.0: remote name/database name for the database
  2. Perform steps 1-3 of In-Process HSQLDB (they also apply when using a dedicated HSQLDB).
  3. Enter the the database name and specify the address/location of HSQLDB, e.g. hsql://localhost/localDB.

For the dedicated HSQLDB instance to be used by deployed applications, you need to adjust the corresponding datasource to connect to it. Go to the Wildfly Console and change the Connection URL to jdbc:hsqldb:hsql://localhost/localDB, so that it matches your previously defined database name.

Accessing HSQLDB

HSQLDB Database Manager

  1. Execute the following on a shell: java -cp path-to-your-hsqldb/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing
  2. Connect to the HSQLDB server.
    • Type: HSQL Database Engine Server
    • Driver: org.hsqldb.jdbcDriver
    • URL: jdbc:hsqldb:hsql://localhost/localDB (adjust to match your database name)
    • User: sa
  3. Perform queries on HSQLDB.

SQL Scrapbook

  1. In-Process HSQLDB only: Stop WildFly to shutdown HSQLDB.
  2. Right-click on connection and select “Connect”.
  3. Right-click on connection and select “Open SQL Scrapbook”.
  4. Perform queries on HSQLDB.
  5. In-Process HSQLDB only: Right-click on connection and select “Disconnect”, before starting WildFly again.