Table of Contents
List of Tables
List of Examples
If you notice any mistakes in this document, please email me at email@example.com so that I can correct them. You can also email me if you have problems with the procedures explained herein, or if you have questions, comments, suggestions or complaints.
This document is available in several formats.
You may be reading this document right now at http://hsqldb-ber.sourceforge.net/HSQLDB-BER, or in a distribution somewhere else. I hereby call the document distribution from which you are reading this, your current distro.
http://hsqldb-ber.sourceforge.net/HSQLDB-BER hosts the latest versions of all available formats. If you want a different format of the same version of the document you are reading now, then you should try your current distro. If you want the latest version, you should try http://hsqldb-ber.sourceforge.net/HSQLDB-BER.
Sometimes, distributions other than http://hsqldb-ber.sourceforge.net/HSQLDB-BER do not host all available formats. So, if you can't access the format that you want in your current distro, you have no choice but to use the newest version at http://hsqldb-ber.sourceforge.net/HSQLDB-BER.
Table 1.1. Alternate formats of this document
|format||your distro||at http://hsqldb-ber.sourceforge.net/HSQLDB-BER|
HSQLDB can be used with Perl via the DBI and DBD::JDBC modules, without this HSQLDB-BER product. You don't need HSQLDB-BER to access a fantastic database (HSQLDB) by coding perl to the DBI API. And, even though the DBD::JDBC documentation implies otherwise, you can even run HSQLDB database instances directly in the DBD::JDBC-supplied proxy server (by just using "mem", "file", or "resource" HSQLDB JDBC URLs). The purpose of HSQLDB-BER is to add the following important features.
Unique features of HSQLDB-BER
HSQLDB is better than any other database for use with DBD::JDBC because there will be no proxying involved. HSQLDB is already known for being the fastest of the fast databases. Whether you use the DBD::JDBC-supplied server or HSQLDB-BER, you can access HSQLDB directly from your perl scripts without the performance and resource cost of a proxy server.
The same HSQLDB JVM can serve the normal "hsql" protocol, the "ber" protocol for Perl clients, "hsqls", "http", "https", etc., all at the same time. This package comes with utilities which make it easy to run any of these combinations and to embed your own Java applications if you wish.
The auto-of-the-box configuration runs one Java JVM that serves both "hsql" JDBC requests, and "ber" perl requests. Client perl code just uses DBI with a resource locator string beginning with ber:hsqldb:. Java client code just uses JDBC with a JDBC URLs beginning with jdbc:hsqldb:hsql:.
This project may be distributed according to the terms of the GNU GPL or the Perl Artistic License, with some portions also being covered by the HSQLDB license. The text of both licenses reside in distributed with HSQLDB-BER in the same directory as this file.
This document you are reading is the primary documentation for HSQLDB-BER. Documentation for the component technologies is not duplcated here. If you want documentation for HSQLDB, the DBD::JDBC or DBI perl modules, or perl programming, see the documentation for that product. See the Resources appendix below. You're better off to go by this document than the README.txt in the doc subdirectory of the HSQLDB-BER distribution, because this is the one that will be maintained most vigorously.
Download the binary distribution with name like hsqldb-ber-0.1a.zip to the computer to house your database server. Unzip the zip file to any directory. Everything will expand into a new directory named something like hsqldb-ber-0.1a. We hereafter call this the HSQLDB-BER installation directory.
You need to have Perl and some specific Perl modules installed on the servers that will execute your perl scripts. If this is your first install, then I suggest that you hold off on that and install Perl and the Perl modules on the database server computer. This makes it extremely easy to run the sample configuration and give yourself a warm fuzzy.
On the computers to host your Perl scripts, install the Perl modules DBI, Convert::BER, and DBD::JDBC if any of them are not already installed.
Before you run make for DBD::JDBC, edit the file JDBC.pm and comment out the two lines containing SQL_BIGINT. These lines are obsolete and will cause things to fail.
I recommend that you don't bother running the supplied tests. The results aren't worth the entire pain-in-the-ass to get the test itself to run. When I have time, I'll try to track down the author of DBD::JDBC and get the SQL_BIGINT problem taken care of at the source.
The documentation of DBD::JDBC will say that the module is for use with a Java proxy server. Disregard that-- It is true when using the DBD::JDBC-supplied proxy-server, but you will be using a direct HSQLDB database server (which the main point of the HSQLDB-BER product).
There will be a subdirectory of your HSQLDB-BER installation directory named samples. Cd into that directory and run
Example 2.1. Running a HSQLDB Server + BerServer
java -jar ../hsqldb-ber.jar org.hsqldb.Server org.hsqldb.BerServer
java -cp path/to/hsqldb-ber.jar:path/to/hsqldb.jar:path/to/dbd_jdbc.jar \ org.hsqldb.BerServer
Once again, cd to the samples directory under your hsqld-ber installation diretory. Execute the perl script sample.pl. (You can make this script "executable". It is only delivered non-executable due to a portability constraint of the build tool which we use).
You can manage your database on the command-line by running
Use a JDBC URL like jdbc:hsqldb:hsql://localhost:9010/play, as determined by the settings in your server.properties file. If you want a command-line tool, then I recommend SqlTool, as documented in the HSQLDB User Guide.
Use DBI/DBD::JDBC according to the POD/man-page documentation, except in place of a JDBC url, use a HSQLDB BER resource locator beginning with ber:hsqldb:, like
The connect string must consist of ber:hsldb: + the dbname specified in your berserver.properties file. For the sample configuration, the berserver.properties file contains the line