A Preliminary Study on the derby (cloudscape) Database

Source: Internet
Author: User
Tags db2 sql error sql error ibm developerworks
1. This database can be downloaded from both IBM and Apache. cloudscape is a commercial version of the derby database, which is presented by IBM and called after Apache. The current Apache version is Derby10.1.0.0alpha (Apr28, 2005SVN165185 ). Because of the alpha version and data of Derby10.0.2.2 (Apr28, 2005SVN165169 ),

1. This database can be downloaded from both IBM and Apache. cloudscape is a commercial version of the derby database, which is presented by IBM and called after Apache. The current Apache version is Derby 10.1.0.0 alpha (Apr 28,200 5/SVN 165185 ). Data of the alpha version and Derby 10.0.2.2 (Apr 28,200 5/SVN 165169) versions

1. This database can be downloaded from both IBM and Apache. cloudscape is a commercial version of the derby database, which is presented by IBM and called after Apache.
The current Apache version is Derby 10.1.0.0 alpha (Apr 28,200 5/SVN 165185 ). Since alpha and Derby 10.0.2.2 (Apr 28,200 5/SVN 165169) versions provide few additional tools, I went to the IBM website to download the database.
The current version of the IBM website is V10.0.2.0 Build: 30301. It provides three download types: linux with installer, win32, and a single zip package without installer. Win32 includes jdk1.4. Considering that my machine has been forced to install n jdk, I downloaded a single zip package of cloudscape. IBM: Release.
2. download and run java-jar 10.0-IBM-Cloudscape.jar, the installation interface appears, here you need to specify the installation directory, please note that the installation directory should not contain spaces.
3. After installation, you need to set some environment variables. Add the following environment variables as needed:
Environment variables in the database installation directory:
CLOUDSCAPE_INSTALL = D: \ IBM \ Cloudscape_10.0
Add the following to classpath:
.; % CLOUDSCAPE_INSTALL % \ lib \ derby. jar; % CLOUDSCAPE_INSTALL % \ lib \ derbynet. jar; % CLOUDSCAPE_INSTALL % \ lib \ derbytools. jar; % CLOUDSCAPE_INSTALL % \ lib \ db2jcc. jar; % CLOUDSCAPE_INSTALL % \ lib \ db2jcc_license_c.jar
Add:
% CLOUDSCAPE_INSTALL % \ frameworks \ NetworkServer \ bin
4. You can operate the database now. The database provides two database engines: 1. The server architecture serves as the engine of the Client/Server. 2. As a database engine that can be embedded into the class library. You should be familiar with the c/s engine. The database engine that can be embedded in the class library is running in the same JVM as the java program, and does not need to start the database or manage the database (I also know about this ).
1. Database Access in C/S Mode:
Open the dos interface, press startNetworkServer to start the database, and then open a dos interface and press ij to manage the database.
There is a demo database of toursDB under D: \ IBM \ Cloudscape_10.0 \ demo \ databases. to connect to this database, we can enter: connect 'jdbc: derby: net: Under ij: // localhost: 1527/"D: \ IBM \ Cloudscape_10.0 \ demo \ databases \ toursDB "'
For example, here are some simple operations on the database:
-- Connect to the database:
Ij> connect 'jdbc: derby: net: // localhost: 1527/"D: \ IBM \ Cloudscape_10.0 \ demo \ databases \ toursDB "';
-- Create a table named abc:
Ij> create table abc (a int, B int );
0 rows inserted/updated/deleted
-- Insert data to the abc table. If there is no into error, sybase is used to it.
Ij> insert abc values (1, 2 );
ERROR 42X01: DB2 SQL error: SQLCODE:-1, SQLSTATE: 42X01, SQLERRMC: Encountered "abc" at line 1, column 8? 42X0 (? It represents a strange character. When spaces is released, the system prompts "this space is temporarily unavailable". Why can't I use it? Instead, it took me 10 minutes to find the problem, TNND)
-- The data entered this time.
Ij> insert into abc values (1, 2 );
1 row inserted/updated/deleted
-- View the inserted data
Ij> select * from abc;
A | B
-----------------------
1 | 2
1 row selected
-- Disconnect the database and no information is output
Ij> disconnect;
-- Exit ij
Ij> exit;
Note that the command Terminator is a semicolon (;).
If you want to stop the database, type stopnetworkserver in dos.
2. database access can be embedded in the class library mode (In this mode, the database does not need to be started, and only one connection in ij can be used to operate the database)
My toursDB database directory is C: \ IBM \ Cloudscape_10.0 \ demo \ databases. If the directory of the DOS interface is already in this directory, after entering ij, you can directly input "connect 'jdbc: derby: toursdb';" to connect to the database. Otherwise, you must specify the database path "connect 'jdbc: derby: C: \ IBM \ Cloudscape_10.0 \ demo \ databases \ toursDB ';". Below are some of my access to the database:
Ij> connect 'jdbc: derby: toursdb ';
Ij> select * from cities;
CITY_ID | CITY_NAME | COUNTRY | AIRPORT | LANGUAGE
| COU &
Bytes ----------------------------------------------------------------------------------------------------
------------
1 | Amsterdam | Netherlands | AMS | Dutch
| NL
................................. And so on.
87 rows selected
Ij> disconnect;
Ij> exit;
C: \ IBM \ Cloudscape_10.0 \ demo \ databases>
Cities are a built-in table of the toursDB database. Other tables include airlines, countries, flightavailability, flights, flights_history, and maps.
For some database operation commands, you can enter help under ij to view the Detailed help information in D: \ IBM \ Cloudscape_10.0 \ doc \ pdf, there are many articles on cloudscape related technologies in DB2 on IBM developerWorks at: http://www-128.ibm.com/?works/cn/index.html. There are also IBM's online help manual with 3 Chinese, URL: http://www.elink.ibmlink.ibm.com/public/applications/publications/cgibin/pbi.cgi? CTY = US & FNC = ICL. Select cloudscape.

As a db, the embedded engine is not very clear about how it works. Later I considered it as a powerful Access database. In this way, I think it is more intuitive to understand it as an Access database.

Currently, I have used eclipse to access the three plug-ins of derby:

1) The two plug-ins of ibm and apache are used together. After installation, right-click the java project and the "Apache Derby" appears. There is a menu "Add Apache Derby nature" in it ", after you click it, the start, ij, and sysinfo tools are displayed. This plug-in is just like this.

2) It is more powerful to access the derby. dbedit plug-in using the Quantum or dbedit plug-in. You can perform table alert operations visually. It seems that there is no proc, view display interface. Quantum has the proc and view display interface, but it cannot be used to add tables visually. Both have visual SQL edit interfaces. I am not sure how to use derby jdbc to access the database. I can only use db2 jdbc to access the database. The url is: jdbc: db2: // localhost: 1527/"C: \ IBM \ Cloudscape_10.0 \ demo \ databases \ toursDB"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.