DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

SQuirrel SQL Client 连接 Derby 数据库过程


前置步骤

解压derby安装包; 网络模式下作为Server需要运行\(DERBY_HOME/bin/startNetworkServer.bat, 内嵌模式下不需求运行此文件; 内嵌模式下使用\)DERBY_HOME/bin/ij.bat创建数据库: connect 'jdbc:derby:e://mydoc//derbyfiles//godu;create=true';

或者使用Squirrel SQL创建数据库:首先安装内嵌驱动:

Name: Apache Derby Embedded

Example URL: jdbc:derby:path;

Website URL: http://db.apache.org/derby/

Extra Class Path: f:\Software\db-derby-10.6.2.1-bin\lib\derby.jar(点击"List Drivers")

Class Name: org.apache.derby.jdbc.EmbeddedDriver

然后创建数据库:

Name: derby@localhost

Driver: Apache Derby Embedded

URL: jdbc:derby:e:/mydoc/derbyfiles/godu;create=true;(如果不新建数据库,create=false)

user name & password留空

确定后在Objects/derby@localhost/APP/TABLE下就可以看到NE表了, 之后就可以使用SQL语句创建表格、插入数据了,derby似乎没有“用户”的概念: create table conn(id int primary key, name varchar(20), protocol varchar(20), ip varchar(20), port int); 建表,

insert into conn values(1,'10024723', 'telnet', '10.0.2.47', 23);插入记录

update conn set id=10024723 where name='10024723';修改记录

alter table conn add password varchar(20);插入新列

update conn set username='godu',password='godu' where id=10025022;更新多个字段值

drop table ne;删除表

内嵌式数据库与访问它的程序使用同一个JVM,所以当Squirrel SQL打开某个内嵌数据库时, ij.bat或者应用程序(通过JDBC)就不能访问该库;

网络模式下

安装Apache Derby Client驱动程序:

名字:Apache Derby Client;

地址示例:jdbc:derby://[:]/[;=];

网站地址:http://db.apache.org/derby;

类路径:derbyclient-10.7.1.1.jar完整路径;

类名:org.apache.derby.jdbc.ClientDriver;

创建连接Derby数据库的别名:

名字:derby@67;

驱动程序:Apache Derby Client;

地址:jdbc:derby://10.0.3.67:1527/godu;create=true;

用户名:godu

密码:godu



Published

Dec 29, 2011

Last Updated

Dec 29, 2011

Category

Tech

Tags

  • sql 4
  • squirrel 4

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor