This example program is a very minimal JDBC application. JDBC is the primary API for interacting with Cloudscape. This program accomplishes the following tasks:
The application can run in any of the following environments:
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.
The application connects to Cloudscape over the network. Cloudscape is already running embedded in a connectivity or server framework that allows multiple network connections. This application can use either of the following frameworks:
This example shows that the application works almost the same regardless of the environment. Only minor modifications to the code are needed to suit the environment.
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 CloudscapeDB 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, CloudscapeDB, was also set in the database connection URL.
The directory that holds the database log for the CloudscapeDB database.
The directory that holds the data for the CloudscapeDB database.
An internal file that holds boot-time configuration parameters for the CloudscapeDB database; do not edit.
Library or Directory |
Path to Library or Directory |
---|---|
main Cloudscape library for your product (cloudscape.jar or |
%CLOUDSCAPE_INSTALL%/lib/NameOfYourLibrary |
current directory |
. |
You run the utility like this:
java COM.cloudscape.tools.sysinfo -cp arguments
So for the arguments you need here, run it like this (all on one line):
java COM.cloudscape.tools.sysinfo -cp embedded CloudscapeSimpleApp.class
If your environment is set up correctly, the utility shows output indicating success. It looks like this:
Cloudscape primary library (cloudscape.jar or cloudsync.jar)
user-specified class (CloudscapeSimpleApp)
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 CloudscapeSimpleApp class to your class path, the utility would indicate as such:
Testing for presence of Cloudscape-related libraries for embedded environment.
Cloudscape primary library (cloudscape.jar or cloudsync.jar)
A successful run produces the following output:
CloudscapeSimpleApp starting in embedded mode.
Loaded the appropriate driver.
Connected to and created database CloudscapeDB
Created table CloudscapeDB
Inserted 1956 Webster
Inserted 1910 Union
Updated 1956 Webster to 180 Grand
Updated 180 Grand to 300 Lakeshore
Verified the rows
Dropped table CloudscapeDB
Closed result set and statement
Committed transaction and closed connection
Database shut down normally
CloudscapeSimpleApp finished
In this demo, you start Cloudconnector, then connect to it from a client. You will be creating two different environments--one for the server and one for the client.
You must have both weblogic.properties and a folder called CloudscapeServer in the directory in order to start Cloudconnector. If either of these is missing, Cloudconnector does not start.
(The directory in which these items live is also known as weblogic.system.home.)
You run the utility like this:
java COM.cloudscape.tools.sysinfo -cp arguments
So for the arguments you need here, run it like this (all on one line):
java COM.cloudscape.tools.sysinfo -cp CloudconnectorServer
If your environment is set up correctly, the utility shows output indicating success. It looks like this:
Cloudscape primary library (cloudscape.jar or cloudsync.jar)
Main Cloudconnector libraries (/classes)
Cloudconnector auxiliary libraries (weblogicaux.jar)
Cloudconnector license library (/license)
SUCCESS: All Cloudscape-Related classes for CloudconnectorServer 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 %CLOUDSCAPE_INSTALL%/frameworks/cloudconnect/license/ directory, the utility would indicate as such:
Testing for presence of Cloudscape-related libraries for CloudconnectorServer environment.
Cloudscape primary library (cloudscape.jar or cloudsync.jar)
Main Cloudconnector libraries (/classes)
Cloudconnector auxiliary libraries (weblogicaux.jar)
You run the utility like this:
java COM.cloudscape.tools.sysinfo -cp arguments
So for the arguments you need here, run it like this (all on one line):
java COM.cloudscape.tools.sysinfo -cp CloudconnectorClient CloudscapeSimpleApp.class
If your environment is set up correctly, the utility shows output indicating success. It looks like this:
Testing for presence of Cloudscape-related libraries for CloudconnectorClient environment.
Cloudscape Client libraries (client.jar)
Main Cloudconnector libraries (/classes)
Cloudconnector auxiliary libraries (weblogicaux.jar)
Cloudconnector license library (/license)
user-specified class (CloudscapeSimpleApp)
SUCCESS: All Cloudscape-Related classes for CloudconnectorClient 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 %CLOUDSCAPE_INSTALL%/frameworks/cloudconnect/license/ directory, the utility would indicate as such:
Testing for presence of Cloudscape-related libraries for CloudconnectorClient environment.
Cloudscape Client libraries (client.jar)
Main Cloudconnector libraries (/classes)
Cloudconnector auxiliary libraries (weblogicaux.jar)
user-specified class (CloudscapeSimpleApp)
Users on other platforms can execute the command that the file contains instead.
After starting the server, you should see startup messages from the server. If the server starts successfully, the last message will say:
java CloudscapeSimpleApp sysconnectclient
The argument sysconnectclient indicates that the application should use the Cloudconnector framework. The application also assumes that the server framework is running on localhost at the default port number. Examine the source code for the application to see how it works.
A successful run produces the following output:
CloudscapeSimpleApp starting in sysconnect mode.
Loaded the appropriate driver.
Connected to and created database CloudscapeDB
Updated 1956 Webster to 180 Grand
Updated 180 Grand to 300 Lakeshore
Closed result set and statement
Users on other platforms can execute the Java command that the script contains, instead:
java weblogic.T3Admin t3://localhost:7001 SHUTDOWN system paceesalute
Stopping the server by typing ^C in the server console window means that Cloudscape will have to run recovery on the database the next time it starts up. Avoid this by using the stopCS command to stop the server framework.
In this demo, you will start the RmiJdbc Server, then connect to it from a client. You will be creating two different environments--one for the server and one for the client.
You run the utility like this:
java COM.cloudscape.tools.sysinfo -cp arguments
So for the arguments you need here, run it like this (all on one line):
java COM.cloudscape.tools.sysinfo -cp RmiServer
If your environment is set up correctly, the utility shows output indicating success. It looks like this:
Cloudscape primary library (cloudscape.jar or cloudsync.jar)
RmiJdbc server and client libraries (RmiJdbc.jar)
SUCCESS: All Cloudscape-Related classes for RmiServer 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 %CLOUDSCAPE_INSTALL%/frameworks/RmiJdbc/classes/RmiJdbc.jar file, the utility would indicate as such:
Testing for presence of Cloudscape-related libraries for RmiServer environment.
Cloudscape primary library (cloudscape.jar or cloudsync.jar)
RmiJdbc server and client libraries (RmiJdbc.jar)
You run the utility like this:
java COM.cloudscape.tools.sysinfo -cp arguments
So for the arguments you need here, run it like this (all on one line):
java COM.cloudscape.tools.sysinfo -cp RmiClient CloudscapeSimpleApp.class
If your environment is set up correctly, the utility shows output indicating success. It looks like this:
Testing for presence of Cloudscape-related libraries for RmiClient environment.
Cloudscape Client libraries (client.jar)
RmiJdbc server and client libraries (RmiJdbc.jar)
user-specified class (CloudscapeSimpleApp)
SUCCESS: All Cloudscape-Related classes for RmiClient 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 %CLOUDSCAPE_INSTALL%/frameworks/RmiJdbc/classes/RmiJdbc.jar file, the utility would indicate as such:
Testing for presence of Cloudscape-related libraries for RmiClient environment.
Cloudscape Client libraries (client.jar)
user-specified class (CloudscapeSimpleApp)
Users on other platforms can execute the command that the file contains instead (all on one line):
java -ms16m -mx32m RmiJdbc.RJJdbcServer COM.cloudscape.core.JDBCDriver
After starting the server, you should see startup messages from Cloudscape. If the server starts successfully, the last message will say:
java CloudscapeSimpleApp rmijdbcclient
The argument rmijdbcclient indicates that the application should use the RmiJdbc framework. The application also assumes that the server framework is running on localhost at the default port number. Examine the source code for the application to see how it works.
A successful run produces the following output:
CloudscapeSimpleApp starting in rmijdbc mode.
Loaded the appropriate driver.
Connected to and created database CloudscapeDB
Updated 1956 Webster to 180 Grand
Updated 180 Grand to 300 Lakeshore
Closed result set and statement
Users on other platforms can execute the Java command that the script contains, instead:
java RJPing jdbc:rmi:jdbc:cloudscape:;shutdown=true;user=;password= connect
java RJPing jdbc:rmi:jdbc:cloudscape: shutdown
Stopping the server by typing ^C in the server console window means that Cloudscape will have to run recovery on the database the next time it starts up. Avoid this by using the stopCS command to stop the server framework.
Cloudscape Version 3.6
For technical support, go to: www.informix.com and click Services.