起動

glassfishに付属しているderbyを使う場合です。

commandline

>"\Program Files\glassfish-4.1\javadb\bin\ij"

データベースへ接続

commandline

ij> connect 'jdbc:derby:データベースディレクトリへのパス`;

データベースディレクトリへのパスは、相対パスでもOKです。

スキーマ一覧

commandline

ij> show schemas;

テーブル一覧

commandline

ij> show tables;

スキーマを指定するときは、in スキーマ名を付ける。

commandline

ij> show tables in app;

テーブル構造を見る

commandline

ij> describe テーブル名;

あるいは

commandline

ij> describe スキーマ名.テーブル名;

テーブルに付いている制約名を取得する

commandline

ij> select c.constraintname from sys.systables t, sys.sysconstraints c, sys.syskeys k where t.tableid=c.tableid and t.tablename='テーブル名' and c.constraintid=k.constraintid;