![]()
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Getting an Application to Start Up CloudscapeA Cloudscape application is a Java application that interacts with Cloudscape using the standard JDBC API (application programming interface). The JDBC API is part of the JDK and is not provided by Cloudscape. It consists of the java.sql package, which is a set of classes and interfaces that make it possible to access databases from a Java application. In order to interact with Cloudscape, an application must first start up the Cloudscape JDBC driver. A JDBC driver is an application that implements the JDBC interface and is loaded by the JDBC driver manager. The name of embedded Cloudscapes JDBC driver is COM.cloudscape.core.JDBCDriver. The method you use to start up the driver is not actually part of the java.sql package; it is the only method for interacting with Cloudscape that is not part of that package. To start up Cloudscape and make it available for connections, you pass the name of the JDBC driver to the Class.forName method, which you will do in the following example. TASK: Test the Class Path ScriptCloudscape provides a utility to test whether your class path is correct for a particular environment. In this tutorial, you work mostly in an embedded environment. Therefore you can run the utility with the following arguments:
TASK: Creating, Compiling, and Running HelloWorld
Figure 2-3 . The HelloWorld application The HelloWorld application attempts to load the Cloudscape JDBC driver. If it succeeds, it prints a message. If it fails, it prints an error message.
If the program successfully loads the Cloudscape JDBC driver, it prints the following message: Loaded the cloudscape JDBC driver. Hello, World! If the program prints out the error message instead, check your class path. Reread Getting Acquainted with Class Path if you got your class path wrong. TASK: Experiment: Try to Get an ErrorAs an experiment, deliberately try to get an error with this program. Here are some possibilities:
All three possibilities will cause the program to fail because the JVM will not be able to find the Cloudscape JDBC driver. | ||
![]() ![]() ![]() ![]() ![]() ![]() | ![]() ![]() Cloudscape Version 3.0 ![]() For technical support, go to: www.cloudscape.com and click Support. Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved. |