|[ Team LiB ]|
Getting Started with Cloudscape
Cloudscape, recently acquired by IBM, is a relational database that supports the SQL standards. This book assumes that you are working with Cloudscape. However, the same concepts described here apply to any relational database available today.
The Cloudscape database also has a JDBC driver. This enables Java applications to use Cloudscape as a data store.
If you don't already have Cloudscape installed, you can download and install a version from the IBM Web site. The Cloudscape site (http://www.ibm.com/software/data/cloudscape/) has plenty of documentation that can walk you through this process.
Using My SQL
Using Cloudscape's Cview tool, open or create a database and then create a People table to be used with the samples later in this hour. To do this, use the following SQL statement:
CREATE TABLE People ( name VARCHAR( 75 ), age TINYINT )
From earlier reading, this statement should now look familiar. The only thing that may seem unusual are the data types. In this example, we used a varchar, which is used to store strings of varying lengths, and a tinyint, which is equivalent to a Java Byte. When declaring the varchar, we specified that the maximum size of the string should be 75 characters.
You'll also need to populate the table with some data. Add a few entries using a SQL statement that looks like this:
INSERT INTO People( name, age ) VALUES ( 'aName', 'anAge );
Simply replace aName and anAge with the values you want to place in the table. Execute this statement with new values a few times so that you'll have a little bit of data to work with.
Getting Ready to UseCloudscape
The next section describes JDBC, but before getting into the details, you need to know that when using JDBC to connect from a Java application to a database, you require a JDBC Driver. To enable Tomcat to load the Cloudscape-specific JDBC drivers, you need to put the cloudscape.jar file in the WEB-INF/lib directory.
|[ Team LiB ]|