Appendix D. Running Hsqldb with OpenOffice.org 1.1.x

## Appendix D. Running Hsqldb with OpenOffice.org 1.1.x

### Hermann Kienlein

EDV - Systeme Kienlein
`<hermann@kienlein.com>`

Copyright 2003-2004 Hermann Kienlein. Permission is granted to distribute this document without any alteration under the terms of the HSQLDB license. Additional permission is granted to the HSQLDB Development Group to distribute this document with or without alterations under the terms of the HSQLDB license.

$Date: 2005/06/08 01:05:00 $

## Introduction

HSQLDB can now act as a Database with OpenOffice.org. This document is written to help you connecting and running HSQLDB out of OpenOffice.org in a simple way. Without user-managment and only for your single-system.

If you have problems read the other available documents, because I will not write them here again. If you need a real DB-System with user-management and different rights for different users, read the other documents.

HSQLDB is included with OpenOffice.org 2.0 and is used by default. Please refer to standard OpenOffice.org 2.0 documentation on how to use HSQLDB with this version.

## Installing

I assume you have a running OpenOffice.org (OOo) and a JavaRuntimeEnvironment. So place the hsqldb_*.zip file where you want on your disk and unpack it (I assume you have done this already).

## Setting up OpenOffice.org

Start OOo with a text document and go to the Database-Explorer (simply by pressing F4). In the left frame you see a tree-view with all known databases in OOo.

A right mouse-click opens a menu where you can manage your databases. So click on `New Database` and choose a name that you want to have inside OOo. I chose HSQLDB as name.

As connection-type choose JDBC and then switch to the JDBC-tab.

As Driver-Class insert `org.hsqldb.jdbcDriver` and as URL choose the following:

### On Windows

You can specify a directory where HSQLDB should store the info and data. Something like `jdbc:hsqldb:file:c:\javasrc\hsqldb-dev\databasename` (where jdbc: is written by OOo). The string `c:\javasrc\hsqldb-dev\databasename` works only on windows, but you can write this down as linux-path like `/javasrc/hsqldb-dev/databasename` too. Then HSQLDB takes the c:\ drive as root. This means this works only on c:\ for you.

The first is the directory-path and the databasename is the identifier for the database.

### On Linux

Choose a path as said for windows like /opt/db/data

As username take sa, this is the standard-administrator for HSQLDB.

Now click the OK-Button

Now OOo has to find your `hsqldb.jar` file. So go to options => security and insert the path to the .jar file. If you have problems, search the Online-help for JDBC. You then get help in your own language (this is generally quite better than my English, I think ;-)

If you cannot write to your Tables, OOo thinks that you don't have permission to write to HSQLDB. Then we tell OOo to ignore the DriverPrivileges because on our single-user-system we do not need them.

Because OOo is working on this, the next Step is only needed for systems without write - permission.

So we go to http://dba.openoffice.org and look at the `IgnoreDriverPrivileges.html` file in the HowTo-section. You find here a macro-code.

Open tools => macro in OOo to get the Basic-IDE. Here simple copy and paste the code and run the macro. You see a input-box where you only have to insert the name of your DB, in my example I have to insert HSQLDB, because I took this as name in OOo.

Note that if you change your OOo-DB name, you have to run this macro again!

Now we only have to stop and restart OOo. Be sure that you exit Quickstarter and all running processes too. On next OOo-Start you should have a running Database in OpenOffice.org.

Appendix C. Hsqldb Database Files and Recovery |  | Appendix E. Hsqldb Test Utility