Search code examples
javahsqldb

How to connect to standalone HSQLDB


I have a problem connecting to an old project HSQLDB (need to migrate it to MySQL). The DB is standalone, file based. I'm using hsqldb-2.4.0 to connect. Tried to follow all instructions and this forum tips to no avail. Getting authorization error java.sql.SQLInvalidAuthorizationSpecException: invalid authorization specification

This is what I do

1) start service

java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:db.hsqldb -dbname.0 xdb

--> seems to start correctly

2) trying to connect

java -cp hsqldb.jar org.hsqldb.util.DatabaseManagerSwing --driver org.hsqldb.jdbcDriver --URL jdbc:hsqldb:hsql://localhost/xdb --user "SA"

--> invalid authorization

My understanding from the script is that a default username/password (SA/no password) was used:

CREATE USER SA PASSWORD DIGEST '67a2fc38c682b3d55125dbc9d0bd26a3'

(not sure how to check it otherwise)

Any help/ideas are greatly appreciated.


Solution

  • The DIGEST is not for the default, empty string, password. Before starting the server, edit the .script file and change the digest to 'd41d8cd98f00b204e9800998ecf8427e', which is the digest for empty string passwords.