DJG HSQLDB Linux Install Notes

I proceeded as follows.

First I downloaded the zip file hsqldb-2.7.0.zip from https://sourceforge.net/projects/hsqldb/files/hsqldb/hsqldb_2_7.

Note this is not the .jar file on that site, but a zip of everything. The main file we need from the zip is sqltool.jar

I unzipped it on my laptop called melania, in a fresh folder and set an environment variable to point to it

  [djg11@melania fresh1]$ export MELANIA_HSQLDB=/home/djg11/d510/databases-course/fresh1
  [djg11@melania fresh1]$ ls
hsqldb-2.7.0
  [djg11@melania fresh1]$ cd hsqldb-2.7.0/
  [djg11@melania hsqldb-2.7.0]$ ls
hsqldb
  [djg11@melania hsqldb-2.7.0]$ cd hsqldb/
  [djg11@melania hsqldb]$ ls
bin    data  doc-src	 integration  modinfo-src  sample  stylesheets
build  doc   index.html  lib	      readme.txt   src	   testrun

The zip file contains builds for two versions of java. I have Java version 8 installed on my laptop,

  [djg11@melania hsqldb]$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
so I have to rename two files in the lib folder.

I could just have used

    $ cd lib
    $ mv hsqldb-jdk8.jar hslqdb.jar
    $ mv sqltool-jdk8.jar sqltool.jar
  

which would have deleted the existing files with those names (which are for the other Java version which I am not needing). Instead I placed the renamed files in a new folder called renamed.

    $ cd lib
    $ mkdir renamed
    $ mv hsqldb-jdk8.jar renamed/hslqdb.jar
    $ mv sqltool-jdk8.jar renamed/sqltoolish.jar # Also I added ish for fun.
    $ export MELANIA_HSQLDB=/home/djg11/d510/databases-course/fresh1
    $ export CLASSPATH=$MELANIA_HSQLDB/hsqldb-2.7.0/hsqldb/lib/renamed
    $ SQLTOOL_JAR=$CLASSPATH/sqltoolish.jar
  

This is then suffient for me to run the tool interactively or with SQL from a file using something like either:

    $ java  -Xbootclasspath/a:$(CLASSPATH)/hsqldb.jar -jar $(SQLTOOL_JAR) --rcfile=./db1a.rc db1a 
    $ java  -Xbootclasspath/a:$(CLASSPATH)/hsqldb.jar -jar $(SQLTOOL_JAR) --rcfile=./db1a.rc db1a l4-q2.sql
  


    

The db1a.rc File

The content of my db1a.rc file is as follows. I believe that SA denotes 'stand alone' and that you do not need to set up or use any password details for single user operation.

    
# If you have the least concerns about security, then secure access to
# your RC file.

# Global default.  .+ matches all lookups:
urlid .+ 
username SA

# Download movies-relational.gz (or .zip) from the course website and
# uncompress it. This will produce a directory movies-relational. 
#
# Windows users are advised to use forward slashes instead of back-slashes,
# and to avoid paths containing spaces or other funny characters.  
#

urlid mem
url jdbc:hsqldb:mem:memdbid


urlid db1a 
url jdbc:hsqldb:file:/home/djg11/d510/databases-course/data-orig/movies-relational/movies;shutdown=true
transiso TRANSACTION_READ_COMMITTED

# Now you can run (in the directory where this db1a.rc file is stored) this command 
#
# java -jar /sqltool.jar --rcfile=db1a.rc db1a

This is based on my having downloaded and unzipped the movies-relational.gz file from the course web site and put it on the place referenced in the above url in my d510 folder.


EOF (C) 2022 DJG.