Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
#!/bin/bash
cd /opt/hsqldb

# Add date to nohup.out file which is automatically created by the nohup command to capture any output from commands sent to it
echo $(date) >nohup.out

# Assuming that java is the the class path.
# Execute Java program calling class path where -cp identifies classpath and,
# Creates a database file called BonsaiResourceBundleDatabase if it does not exist relative to the current directory
# -dbname.0 designates that the database will be called BonsaiResourceBundleDatabase
# Sends Java program to background and to not terminate via nohup command.
nohup java -cp lib/hsqldb.jar org.hsqldb.Server -database.0 file:data/BonsaiResourceBundleDatabase -dbname.0 BonsaiResourceBundleDatabase &

# Without this echosleep, the script will require that the user hit enter to return back to the command line
sleep 1
echo "hsqldb started"

From the HSQLDB manual it provides this example,

...

There is a need to have multiple users for administration of the HSQL database.

The administrator account is "SA" and has all privileges including create, read and write.

The pubic users run through the "twokeysursis" account and staff users have read only access. For managing the database, all 2Keys employees have their own accounts that include read and write, but not createand write access but can not alter tables.

Finally an application account needs to be created.

Warning

This section needs more work. Consider moving the discussion on database accounts into a general area.

To add a user, use the following syntax,

Code Block
languagesql
CREATE USER sheeley password "<password>"
GRANT SELECT ON APP_COMM TO sheeley;
GRANT INSERT ON APP_COMM TO sheeley;
GRANT UPDATE ON APP_COMM TO sheeley;
GRANT SELECT ON BUNDLE TO sheeley;
GRANT INSERT ON BUNDLE TO sheeley;
GRANT UPDATE ON BUNDLE TO sheeley;
GRANT SELECT ON RESOURCE TO sheeley;
GRANT INSERT ON RESOURCE TO sheeley;
GRANT UPDATE ON RESOURCE TO sheeley;

...