![]() |
Cloudscape Basics and the Sample Database
|
|
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 Cloudscape's 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. 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:
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.
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.6 For information about Cloudscape technical support, go to: www.cloudscape.com/support/.Copyright © 1998, 1999, 2000 Informix Software, Inc. All rights reserved. |