sqlhsqldbsqltools

SQLTool does not commit data after quit (HSQLDB)


i really dont understand the SQLTool... i just want to import a SQL File into the database and choosen this command to do this:

java -jar ~/bin/sqltool.jar --autoCommit --inlineRc URL=jdbc:hsqldb:file:/path/to/my/database.hsqldb,USER=SA,PASSWORD='' database.sql

in the database.sql is all the create stuff, like:

create table foo(id identity, name varchar(256));

then i have a second script, called data.sql, which should be written into the database the same, in this one is my whole testdata stuff:

insert into foo(name) values('bla');

when i now execute my bash script, the SQLTool creates a fresh database (before i deleted the file), but does not do anything with the SQL file! The first script runs without errors, but the second says:

SEVERE  SQL Fehler an 'data.sql' Zeile 1:
"insert into foo (name) values('bla')"
user lacks privilege or object not found: FOO
org.hsqldb.cmdline.SqlTool$SqlToolException

when i now connect to the database and say \dt there is no table!

i also put a commit; to the end of each file, and opend the SQLTool with --autoCommit but this doesnt work either... whats going on there?


Solution

  • hsqldb requires SHUTDOWN command prior to last connection close or a JDBC connection property, shutdown=true. See docs.