Cloudscape Access Using RmiJdbc
Page 5 of 6

Accessing RmiJdbc Server from a Client

Client Class Path

Clients need to install and set the class path to point to the libraries indicated in Libraries. To summarize, clients need the following files and directories, shown in their paths relative to the cloudscape base directory:

  • /lib/client.jar
  • server framework classes

    For RmiJdbc, the classes are in frameworks/RmiJdbc/classes/RmiJdbc.jar.

  • /lib/tools.jar

    If using the Cloudscape tools on the client.

JDBC Driver and Database Connection URL for an RmiJdbc Client

The Cloudscape Developer's Guide documents the database connection URL for using Cloudscape as an embedded database.

RmiJdbc supplies a tailored JDBC driver and database connection URL for use with a client.

In client code, specify the client JDBC driver for connecting to a Cloudscape server:

Class.forName("COM.cloudscape.core.RmiJdbcDriver").newInstance();

You can specify the driver in a system property when starting a client tool. For example (using supplied Cloudscape tools):

java -Djdbc.drivers=COM.cloudscape.core.RmiJdbcDriver COM.cloudscape.tools.cview
java -Djdbc.drivers=COM.cloudscape.core.RmiJdbcDriver COM.cloudscape.tools.ij

Client JDK

RmiJdbc client applications can use JDK of 1.1 or 1.2.

Database Connection URL for RmiJdbc

A Cloudscape client to RmiJdbc uses the following database connection URL:

jdbc:cloudscape:rmi:  //hostname:portnum/
[databaseName];[cloudscapeAttributes]

(All of this is one string; the new lines above just make the URL readable.)

NOTE: If you are using the Secure Socket Layer (SSL), there is a special extended URL. See Chapter 8, "SSL Security in Cloudconnector", for details.

  • //hostname:portnum/

    Replace the name hostname with the name of the host running RmiJdbc if it is not running on the same machine as the client. hostname can be localhost. Replace portnum with the port number specified on the RmiJdbc java command line. 1099 is the default value. (See Setting Port Numbers.)

  • [databaseName];[cloudscapeAttributes]

    Specify the database name and any database connection URL attributes as specified in Cloudscape Developer's Guide. For example, to create and connect to a new database called newDB, specify:

    newDB;create=true

Here are some example Cloudscape client database connection URLs:

  • jdbc:cloudscape:rmi://localhost:1099/newDB;create=true;autocommit=false

    Connects to RmiJdbc server installed on the local machine at the default port, creates and connects to a new database called newDB, turning off auto-commit (Cloudscape property).

  • jdbc:cloudscape:rmi://jeeves:5001/accounting/accounts

    Connects to RmiJdbc server running on host jeeves and listening on port 5001, connects to an existing accounts database in the accounting directory.

  • jdbc:cloudscape:rmi://localhost:1099/newDB;user=fred;password=secret

    Specifies user credentials for Fred.

NOTE: Client applications generally should not use the ;shutdown=true form of the database connection URL in client/server environments. The system administrator should use the provided utility to shut down a server.

For a simple example of a an application that connects to RmiJdbc server as a client, see the program CloudscapeSimpleApp in the demo/programs/simple directory.

Using the Cloudscape Tools with RmiJdbc

The Cloudscape tools ij and Cloudview work in both embedded mode and client/server mode.

To access RmiJdbc server using these tools, simply specify the client driver and client database connection URL for the client/server environment (see JDBC Driver and Database Connection URL for an RmiJdbc Client) where appropriate.

The book Cloudscape Tools and Utilities Guide provides numerous examples of how to do this.