This example program is a very minimal JDBC application. JDBC is the primary API for interacting with IBM Cloudscape. This program accomplishes the following tasks:
The application runs in an embedded environment. This is the simplest Cloudscape environment. The application starts up an instance of Cloudscape within the current JVM and shuts down the instance before it completes. No network access is involved. In an embedded environment, only one application at a time can access a database.
Before running this demo, you should see the following files and directories in the /demo/programs/simple directory:
Source code for the example program that starts up Cloudscape, creates a database, does some inserts and updates, and then shuts down Cloudscape. Examine this file to see how the application behaves in the various environments.
After running the demo, you will see some new files and directories:
The directory that makes up the derbyDB database. You must not modify anything in this directory, or you will corrupt the database. The directory was created when the application connected with Cloudscape, using the attribute create=true in the database connection URL. The database name, derbyDB, was also set in the database connection URL.
The directory that holds the database log for the derbyDB database.
An internal file that holds boot-time configuration parameters for the derbyDB database; do not edit.
Library or Directory |
Path to Library or Directory |
---|---|
main Cloudscape library for the product: derby.jar |
%CLOUDSCAPE_INSTALL%/lib/derby.jar |
current directory |
. |
You run the utility like this:
java org.apache.derby.tools.sysinfo -cp arguments
So for the arguments you need here, run it like this (all on one line):
java org.apache.derby.tools.sysinfo -cp embedded SimpleApp.class
If your environment is set up correctly, the utility shows output indicating success. It looks like this:
Cloudscape embedded engine library (derby.jar)
user-specified class (SimpleApp)
SUCCESS: All Cloudscape-Related classes for embedded environment found in class path.
If something is missing from your class path environment, the utility indicates what is missing. For example, if you neglected to add the directory containing the SimpleApp class to your class path, the utility would indicate as such:
Testing for presence of Cloudscape-related libraries for embedded environment.
Cloudscape embedded engine library (derby.jar)
A successful run produces the following output:
SimpleApp starting in embedded mode.
Loaded the appropriate driver.
Connected to and created database derbyDB
Created table derbyDB
Inserted 1956 Webster
Inserted 1910 Union
Updated 1956 Webster to 180 Grand
Updated 180 Grand to 300 Lakeshore
Verified the rows
Dropped table derbyDB
Closed result set and statement
Committed transaction and closed connection
Database shut down normally
SimpleApp finished
IBM Cloudscape Version 10