转世灭神txt全集下载:在Eclipse下,从安装到使用Derby插件
来源:百度文库 编辑:九乡新闻网 时间:2024/04/30 01:05:34
在Eclipse下,从安装到使用Derby插件
will posted @ 2010年12月17日 22:27 in Ubuntu with tags Eclipse Derby DataBase Plugin , 192 阅读未经允许,请勿转载。文章来源:http://willvking.is-programmer.com本文参考资料:
http://www.cecs.csulb.edu/~monge/classes/share/usingEclipseDerby.html
http://www.ibm.com/developerworks/opensource/library/os-ad-eclipse/
http://db.apache.org/derby/integrate/plugin_howto.html
http://db.apache.org/derby/papers/DerbyTut/ij_intro.html
安装Derby Plugin到Eclipse:
首先从Derby下载页面查找最新官方发布的版本(或者需要的版本),下载
derby_core_plugin
和derby_ui_plugin这两个必须的Eclipse插件下载到计算,
并解压缩到Eclipse目录下的plugins文件夹下。注意,压缩包中所有文件可能都默认在plugin文件夹下,所以解压缩後,將得到plugin文件夹(也可能会叫plugin(1))
下的所有文件拷贝到eclipse安装目录下的plugin文件夹中。
被拷贝的文件应该是
org.apache.derby.core_10.6.2
,org.apache.derby.ui_1.1.2
, 和org.apache.derby.plugin.doc_1.1.2这样3个名称的
(根据下载选择,版本好会有不同)。
使用Derby同Eclipse
:
首先,添加DerbyJava项目。运行Eclipse(如果Eclipse在安装Derby前就开着,请重新启动Eclipse)。在PackageExplorer中选择Java项目,右键,
依次选择Apache Derby,Add Apache Derbynature.到此,添加Derby完成。
你可以再次在项目上点击右键,Apache Derby,选择sysInfo(Derby SystemInformation),便能在Eclipse的控制台输出中看到Derby系统信息。如下:
------------------Java Information ------------------
Java Version: 1.6.0_18
JavaVendor: Sun Microsystems Inc.
Java home: /usr/local/jdk1.6.0_18/jre
Java classpath: /windows/E/ComputerStudy/Software Study/Programming/Eclipse Workspace On Ubuntu10.10/AccountManagement/bin:/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derbytools.jar:/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derby.jar:/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derbynet.jar:/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derbyclient.jar
OSname: Linux
OS architecture: i386
OS version: 2.6.35-22-generic
Java user name: knowyourself1010
Java user home: /home/knowyourself1010
Java user dir: /windows/E/Computer Study/SoftwareStudy/Programming/Eclipse Workspace On Ubuntu10.10/AccountManagement
java.specification.name: Java Platform APISpecification
java.specification.version: 1.6
java.runtime.version:1.6.0_18-b07
--------- Derby Information --------
JRE - JDBC: Java SE 6 -JDBC 4.0
[/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derby.jar]10.6.2.1 -(999685)
[/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derbytools.jar]10.6.2.1 -(999685)
[/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derbynet.jar]10.6.2.1 -(999685)
[/opt/eclipse/plugins/org.apache.derby.core_10.6.2/derbyclient.jar]10.6.2.1 -(999685)
------------------------------------------------------
-----------------Locale Information-----------------
------------------------------------------------------在选择sysInfo的同时,能看到一个叫ij(InteractiveSQL)的选项,顾名思义,这是Derby提供的结构查询语言脚本的运行工具,用来执行SQL脚本语句。
选择它,Eclipse的控制台会显示:
ijversion 10.6
ij>在选择sysInfo的位置选择start Derby NetworkServer启动Derby网络服务,接着就可以在eclipse控制台中ij>後输入SQL脚本语句了。
首先,按照http://db.apache.org/derby/papers/DerbyTut/ij_intro.html#ij_create创建一个数据库命令如下:
ij>connect 'jdbc:derby:MyDbTest;create=true';如果得到:IJ ERROR: Unable toestablish connection的提示,可能是你的Derby NetworkServer没有开启。
如果执行成功,刷新PackageExplorer中的项目目录,便能看到一个名为MyDbTest的文件夹和一个derby.log文件。可以打开derby.log文件瞧瞧。
在ij中输入help;可以查看帮助:
ij>help;
Supported commands include:
PROTOCOL 'JDBC protocol' [AS ident ];
-- sets a default or namedprotocol
DRIVER 'class for driver'; -- loads the named class
CONNECT'url for database' [ PROTOCOL namedProtocol ] [ AS connectionName];
-- connects to databaseURL
-- and may assign identifier
SETCONNECTION connectionName; -- switches to the specified connection
SHOWCONNECTIONS; -- lists all connections
AUTOCOMMIT [ ON | OFF]; -- sets autocommit mode for the connection
DISCONNECT [ CURRENT |connectionName | ALL ];
-- drop current,named, or all connections;
-- the default isCURRENT
SHOW SCHEMAS; -- lists all schemas in thecurrent database
SHOW [ TABLES | VIEWS | PROCEDURES | FUNCTIONS | SYNONYMS] { IN schema };
-- lists tables, views,procedures, functions or synonyms
SHOW INDEXES { IN schema | FROM table};
-- lists indexes in a schema, or for atable
SHOW ROLES; -- lists all defined roles in thedatabase,
-- sorted
SHOWENABLED_ROLES; -- lists the enabled roles for thecurrent
-- connection (to see current roleuse
-- VALUES CURRENT_ROLE), sorted
SHOWSETTABLE_ROLES; -- lists the roles which can be set forthe
-- current connection, sorted
DESCRIBE name; -- lists columns in the named table
COMMIT; -- commits the current transaction
ROLLBACK; -- rolls back the current transaction
PREPARE name AS 'SQL-J text'; -- prepares the SQL-J text
EXECUTE { name |'SQL-J text' } [ USING { name | 'SQL-J text' } ];
-- executes the statement withparameter
-- values from the USING result setrow
REMOVE name; -- removes the named previously preparedstatement
RUN 'filename'; -- run commands from the namedfile
ELAPSEDTIME [ ON | OFF ]; -- sets elapsed time mode forij
MAXIMUMDISPLAYWIDTH integerValue;
--sets the maximum display width for
-- eachcolumn to integerValue
ASYNC name 'SQL-J text'; -- run the commandin another thread
WAIT FOR name; -- wait for result ofASYNC'd command
GET [SCROLL INSENSITIVE] [WITH {HOLD | NOHOLD}]CURSOR name AS 'SQL-J query';
-- gets a cursor(JDBC result set) on the query
-- the defaultis a forward-only cursor with holdability
NEXT name; --gets the next row from the named cursor
FIRST name; --gets the first row from the named scroll cursor
LASTname; -- gets the last row from the named scroll cursor
PREVIOUS name; -- gets the previous row from the named scrollcursor
ABSOLUTE integer name; -- positions the named scroll cursor atthe absolute row number
-- (A negative numberdenotes position from the last row.)
RELATIVE integer name; --positions the named scroll cursor relative to the currentrow
-- (integer is number of rows)
AFTERLAST name; -- positions the named scroll cursor after the lastrow
BEFORE FIRST name; -- positions the named scroll cursorbefore the first row
GETCURRENTROWNUMBER name; -- returns the row numberfor the current position of the named scrollcursor
-- (0 is returned when the cursor isnot positioned on a row.)
CLOSE name; -- closes the namedcursor
LOCALIZEDDISPLAY [ ON | OFF ];
--controls locale sensitive data representation
EXIT; -- exits ij
HELP; --shows this message
Any unrecognized commands are treated as potentialSQL-J commands and executed directly.
输入showconnections;可以看到当前链接,如下:
ij>show connections;
CONNECTION0* - jdbc:derby:MyDbTest
* = currentconnection
接在来根据ij介绍,在当前数据库(MyDbTest)中创建表derbyDB,并增加修改数据,控制台输入输出如下:
ij>create table derbyDB(num int, addr varchar(40));
0 rowsinserted/updated/deleted
ij> insert into derbyDB values (1956,'WebsterSt.');
1 row inserted/updated/deleted
ij> insert into derbyDB values(1910,'Union St.');
1 row inserted/updated/deleted
ij> select * fromderbyDB;
NUM |ADDR
----------------------------------------------------
1956 |Webster St.
1910 |UnionSt.
2 rows selected
ij> updatederbyDB set num=180,addr='Grand Ave.' where num=1956;
1 rowinserted/updated/deleted
ij> select * from derbyDB;
NUM |ADDR
----------------------------------------------------
180 |Grand Ave.
1910 |UnionSt.
2 rowsselected依次执行下面命令,断开链接并退出ij:
ij>disconnect;
ij> show connections;
No connections available.
ij>exit;另,执行SQL脚本文件的命令为:
ij>run 'my_file.sql';
在程序中链接MyDbTest数据库的命令有:
Connection conn =DriverManager.getConnection("jdbc:derby:MyDbTest");或者:jdbc:derby:../otherDirectory/MyDbTestjdbc:derby:directory:MyDbTestjdbc:derby:jar:(c:/derby/lib/jar2.jar)MyDbTest
更多链接方式请见:http://db.apache.org/derby/docs/dev/devguide/cdevdvlp34964.html
在Eclipse下,从安装到使用Derby插件
Eclipse怎样在dropins文件夹中安装插件? -s
Eclipse怎样在dropins文件夹中安装插件
Eclipse插件的安装方法
在myeclipse下安装javacc插件
eclipse插件安装方法 - ShaHuShaBoJue的专栏 - CSDN博客
Eclipse插件安装总结 - huxin1的专栏 - CSDN博客
用Eclipse 开发Flex (配置安装Flex插件)
eclipse插件——spket安装妹篇
在Linux下安装和使用MySQL
在eclipse中使用jena
Eclipse 插件安装方法和插件加载失败解决办法 - TATA的专栏 - CSDN博客
Myeclipse8.0下如何安装SVN插件
cygwin移植linux程序到windows及在eclipse中使用cygwin的常见问...
Eclipse插件之EasyExplorer
开发 Eclipse 插件
Eclipse反编译插件
梅贝郎:WPS从网站下载的插件安装在哪个文件夹里? – 电脑数码
Linux环境下Eclipse和Tomcat的安装和配置
如何在DOS下从硬盘安装XP系统
会声会影X2的好莱坞插件怎么安装?怎么使用?
Eclipse插件开发快速入门
Eclipse插件开发之新手入门
常用的Eclipse插件介绍