LoginSignup
3
6

More than 5 years have passed since last update.

[Java][Derby] Apache Derbyコマンドラインメモ

Last updated at Posted at 2015-02-02

起動

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;
3
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
6