Wednesday, November 23, 2016

How to connect to HSQL DB via console

I was using Spring boot(1.4.0.RELEASE)  with HSQL DB(hsqldb-2.2.6) for one of my projects. For one of my purpose, I needed to log to my HSQL DB via console and execute queries manually. After few searchings, I found a specific tool called sqltool(sqltool-2.2.6) which can be used for that purpose.

  1. Download  sqltool(sqltool-2.2.6) via http://www.hsqldb.org/repos/org/hsqldb/sqltool/2.2.6/
  2. Place the sqltool-2.2.6.jar in the same location where hsqldb-2.2.6.jar is available.
  3. Run the sqltool jar using following command.

  4. java -jar <path_to_sql_tool_jar>/sqltool-2.2.6.jar --inlineRc=url=jdbc:hsqldb:file:<path_to_db_where_.log_.propertis_.script>/<db_name>,user=<db_user_name>

  5. Then password will be asked. After authentication, you will log to console.
  6. Remember to close all the other connections to the particular DB otherwise, Database lock acquisition failure will be occured.