Derby使用ij工具操作数据库

阅读更多

解压apache的derby数据库:D:\Program Files\derby\db-derby-10.7.1.1-bin

在home下找到/derby_home/bin/ij工具

启动ij工具

 

ij> connect 'jdbc:derby:ij_cmd_test_db;create=true';
WARNING 01J01: Database 'ij_cmd_test_db' not created, connection made to existing database instead.
ij(CONNECTION1)>select * from table;
ERROR 42X01: Syntax error: Encountered "" at line 1, column 19.
Issue the 'help' command for general information on IJ command syntax.
Any unrecognized commands are treated as potential SQL commands and executed directly.
Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
ij(CONNECTION1)> create table ijtest(num int);
0 rows inserted/updated/deleted
ij(CONNECTION1)> select * from ijtest;
NUM
-----------

0 rows selected
ij(CONNECTION1)> insert into ijtest values (19890521);
1 row inserted/updated/deleted
ij(CONNECTION1)> insert into ijtest values (19890520);
1 row inserted/updated/deleted
ij(CONNECTION1)> insert into ijtest values (19890519);
1 row inserted/updated/deleted
ij(CONNECTION1)> insert into ijtest values (19890518);
1 row inserted/updated/deleted
ij(CONNECTION1)> select * from ijtest;
NUM
-----------
19890521
19890520
19890519
19890518

4 rows selected
ij(CONNECTION1)>

 

按照上面步骤,建立数据库"ij_cmd_test_db",建立数据库表"ijtest",最后查询数据库表"select * from ijtest",查询得到刚刚插入的数据.

 

ij工具命令可以通过进入ij命令行后敲入"help"

 

退出 "exit".

 

后面贴上derby的jdbc的访问方式.

 

附件附上一个比较好的derby文档.

  • derby数据库.zip (53.7 KB)
  • 下载次数: 157

你可能感兴趣的:(derby,ij,jdbc,ij工具,apache)