hsqldbのシェル

hsqldbにも、SQL*Plusのようなシェルがあったのでメモ。

権限の設定

user.home(C:\Documents and...)にsqltool.rcを作成。(参考: Authentication Setup)


sqltool.rc

urlid mem
url jdbc:hsqldb:hsql://localhost
username sa
password

実行

下記のコマンドをたたく。


/C/hsqldb/lib$ java -jar hsqldb.jar mem

実行画面は次のよう。

JDBC Connection established to a HSQL Database Engine v. 1.7.2 database as 'SA'.
SqlTool v. 1.39.                        (SqlFile processor v. 1.90)
Distribution is permitted under the terms of the HSQLDB license.
(c) 2004 Blaine Simpson and the HSQLDB Development Group.

    \q    to Quit.
    \?    lists Special Commands.
    :?    lists Buffer/Editing commands.
    * ?   lists PL commands (including alias commands).

SPECIAL Commands begin with '\' and execute when you hit ENTER.
BUFFER Commands begin with ':' and execute when you hit ENTER.
COMMENTS begin with '/*' and end with the very next '*/'.
PROCEDURAL LANGUAGE commands begin with '* ' and end when you hit ENTER.
All other lines comprise SQL Statements.
  SQL Statements are terminated by either a blank line (which moves the
  statement into the buffer without executing) or a line ending with ';'
  (which executes the statement).

sql> select table_name, table_type from system_tables;
TABLE_NAME                  TABLE_TYPE
--------------------------  ------------
SYSTEM_ALIASES              SYSTEM TABLE
SYSTEM_ALLTYPEINFO          SYSTEM TABLE
SYSTEM_BESTROWIDENTIFIER    SYSTEM TABLE
SYSTEM_CACHEINFO            SYSTEM TABLE
SYSTEM_CATALOGS             SYSTEM TABLE
...