Overview
Page 2 of 3

Technology Overview

Cloudscape Version 3.6 Beta is a Java- and SQL-based object-relational database management system. Cloudscape is written entirely in Java and can be deployed as an unconnected, embedded database manager in another Java application, whether single-user or multi-user. Multi-user applications are often called application servers. Cloudscape can also be embedded inside the lightweight JDBC server framework called RmiJdbc Server, which allows multiple client JDBC applications to connect to a central database server over a network. Cloudconnector is a more powerful framework that provides JDBC, HTTP access, network security, and many other features.

Cloudsync allows periodically connected applications with their own embedded database managers and their own copies of a database to be part of a distributed system. The synchronization technology takes care of keeping the distributed copies of the databases (known as targets) in sync with the central database (called a source).

This section defines some basic database concepts such as database management system (DBMS), relational database management system (RDBMS) and object-relational database management system (ORDBMS). It also looks at SQL, a standard query language, and the exciting features of Cloudscape's Java extensions to SQL.

It covers the following topics:

What Is a DBMS?

A database is information, and a database management system (DBMS) is the software that stores and retrieves the information in the database.

A database is not just random data; it is a collection of data pertaining to one well-defined purpose, structured in such a way that information can be retrieved from it. Imagine a company called JBMSTours. The company sells packaged and customized tours around the globe. JBMSTours constructs a database called toursDB that stores information about the different tours it offers. The database includes information about cities, hotels, and flights. Unrelated information, such as employee salaries, would be in a different database.

(Later in this tutorial, we ask you to imagine this fictional tour company more completely; see The JBMSTours Scenario.)

A database is also self-describing. A database maintains information about the data it stores and how it is organized. This information is called metadata.

The DBMS is the software that accesses, retrieves, and modifies data in a database. A separate application, often called a client application, interacts with the DBMS software to process data, present a user-friendly interface, and provide application logic.

With a Cloudscape database, as you will read in this chapter, some of the distinctions between database and application are blurred. The Java in Cloudscape means that you can store application logic in the form of Java classes in the database and run them in Cloudscape if appropriate, or in the client application, or both.

But more about that later.

Relational Database Management Systems

Cloudscape is an object-relational database management system. A relational database is a database that presents information in one or more tables containing data about a particular entity (such as hotels, cities, or countries). Separate tables in the database are related to each other, so the data in the database can be accessed (or queried) from a single table or from multiple tables at the same time.

The SQL Standard

Cloudscape supports entry-level SQL-92. SQL is the standard query language used with relational databases. (When it was originally created, SQL stood for structured query language, but it does not stand for anything nowadays.) No matter how a particular RDBMS has been implemented, the user can design databases and insert, modify, and retrieve data using the standard SQL statements and well-defined data types. SQL-92 is the version of SQL standardized by ANSI and ISO in 1992. Entry-level SQL-92 is a subset of full SQL-92 specified by ANSI and ISO that is supported by nearly all major DBMSs today.

Transaction Processing and More

An RDBMS provides transaction control, a set of rules and guidelines that ensure that integrity is maintained during and after operations on data. Transaction control is what protects your bank account from being $200 short when you cancel an ATM withdrawal.

Cloudscape, like RDBMSs, provides transaction control, plus automatic crash recovery and runtime rollback.

You can use Cloudscape as an RDBMS, because it supports the basic RDBMS data types, supports the SQL standard, allows you to store data in related tables, and supplies transaction management. Some users simply want a standard relational database that runs in a JVM. For them, Cloudscape is the easy choice.

Proprietary Programming Language

RDBMSs did not originally provide any programmability. They provided a way to store and retrieve data and the ability to run a limited set of functions on the data. Customers implemented logic at the application level--not in the database, as shown in Figure 1-1.

Figure 1-1 A DBMS and a client application

Originally, there were two good reasons for separating these tasks. First, it let each program do the task it was best suited for. Second, it allowed several users with different goals--and perhaps different applications and application logic--to access a central repository of data.

RDBMS vendors later provided some limited programmability, typically with a proprietary language based on SQL that allowed users to implement a simple logic within the database itself. Stored procedures and triggers are both examples of server-side logic.

Cloudscape does provide programmability in the DBMS, but its capabilities are much more powerful than those of an RDBMS. You will read more about this in the next section.

Object-Relational DBMSs

SQL-92 restricts stored data to the integer, floating-point number, character string, date-time, numeric, and decimal data types. Each basic data type provides a fixed number of functions and operators.

Cloudscape is an object-relational DBMS, or ORDBMS. Object-relational DBMSs provide object extensions to the traditional RDBMS functionality. An object-relational database can store and process user-defined objects, which are modules from object-oriented programming, an evolutionary form of modular programming that allows pieces of software to be reused and interchanged between programs. An object consists of both data and corresponding behavior. In object-oriented programming, you do not separate data from the logic that goes with it.

Some RDBMSs store complex objects as "blobs" (binary large objects), which means they cannot execute any of the object's behavior, called methods. A blob isn't really an object at all. Searching for blobs without specialized ways to refine the search makes it difficult to retrieve an object from a database.

In an ORDBMS, however, you can use an object's behavior to assist in object retrieval. A very simple example of a "complex" data type is the City data type from our toursDB sample database, which you will be building later in this tutorial. The City definition includes several methods. For example, you could query the database for a city in the Southern Hemisphere where the average temperature in July is above 80 degrees Fahrenheit.

The Java in Cloudscape

The beauty of Cloudscape is its integration with Java. The complex objects stored in Cloudscape and the stored procedures are written in the Java programming language.

Java is an extremely popular and portable programming language. The Java in Cloudscape makes it powerful in several ways:

  • It is a non-proprietary programming language.
  • It is the same language that runs in client applications, so you can run methods in the database or in the application.
  • Because Java is practically a platform, you can deploy Cloudscape just about anywhere.

Java is an object-oriented programming language developed by Sun Microsystems. Applications written in Java do not interact with a computer's operating system directly. Instead, byte code from compiled Java applications is interpreted by the Java Virtual Machine (JVM). Java applications can run on any computer that has a JVM. In the future, Java applications may be able to run on computers or small devices that contain a "Java chip."

A basic concept in Java is the class. A class is a template for an object; an object is an instance of a class. You create an object by instantiating a class. For example, JBMSTours defines a template for city objects in the City class. The class definition encapsulates all the variables and operations of the City class. In Java, operations are called methods. A particular city, such as Santiago or Paris, is a particular instance of a City. You can create an instance of the City class for these cities; these instances are called objects.

Object-oriented languages are popular because they allow programmers to re-use code. It is easy to re-use or use somebody else's class definitions because Java classes include published interfaces. That is, in order to use a class, you do not have to know internal details. All you need to know is how to use the methods that allow an object of that class to interact with other objects. Even if a programmer changes the internal details, the interface stays the same.

Most Java programmers take advantage of rich collections of existing classes and methods in Java class libraries. Class libraries are provided primarily by compiler vendors, but many class libraries are supplied by independent software vendors. Some class libraries are considered essential to the Java platform: the Java base and core classes, which are included with a Java Development Kit (JDK).

One of the core classes that are important in database applications is the java.sql package, the set of classes that form the JDBC API. JDBC is a Java API (application programming interface) for executing SQL statements. You use this standard API to work with Cloudscape databases.

The bibliography in the preface of this book provides a list of good sources for learning about the Java programming language.

Non-Proprietary Programming Language

You do not have to "translate" a Java object into a proprietary format to store it in a Cloudscape database. You can store Java data types in a Cloudscape database. Because of Java's popularity and reusability, not only can you write your own data types, you can also easily purchase third-party data types that are immediately usable in a Cloudscape database.

Run Methods Anywhere

Because Cloudscape is itself written in Java, it runs within a JVM in the same way as any other Java application does. This makes it easy to migrate user objects from the application to the DBMS and vice versa. A method can run in the application or in Cloudscape. All that is required is to make the application's class files available to the JVM in which Cloudscape is running.

Do you remember Figure 1-1, which showed application logic as separate from the data? With Cloudscape, the picture looks different, as in Figure 1-2.

Figure 1-2 Java objects can run in the client application or in Cloudscape and can be stored in the database.

You do not have to declare these methods within the Cloudscape system, although you can provide aliases for them that makes it easier to run them.

Deploy Cloudscape Anywhere

Cloudscape is a lightweight database with a small footprint. This means that it doesn't use very much memory or disk space, and it is easy to administer.

Normally you wouldn't care what language a DBMS was written in. But Java is more than just a programming language; in some senses, Java is a platform. Because Cloudscape is written in Java, Cloudscape can run in any environment that supports a JVM, or Java Virtual Machine. Cloudscape databases are portable across platforms and easy to manage.

Cloudscape's deployability means that you can embed it in any Java applications. Applications do not need to connect to a central database; they can carry one with them. When Cloudscape is embedded in an application, the application makes local calls to the DBMS. No network connection or networking software is needed.

You can also deploy Cloudscape and Cloudscape applications in a client/server environment. For more information about different Cloudscape deployment possibilities, see Cloudscape Deployment Options.

Synchronization: Keeping Databases in Touch

Cloudscape synchronization allows you to "tear off" partial or complete copies of databases and keep them connected to a corporate system. Any Cloudscape database can be part of a distributed Cloudscape system.

Cloudscape synchronization is a process in which Cloudscape copies dictionary objects, data, and Java objects from a source database to and from one or more target databases and controls consistency of data. Because Cloudscape synchronization is message-based, remote databases do not have to be continuously connected over a network. Remote target databases need only connect intermittently, long enough to send and receive HTTP messages that refresh local data with up-to-date data from a central database.

The advantages of a distributed system are:

  • Better performance, especially response time. Since the data is accessed locally, there is no network latency, the DBMS can cache data that the application is actually using, and the local CPU, memory, and disk resources can be fully utilized without conflict with other users.
  • Nomadic operation. Since the data lives on the remote computer, the computer does not need to be continuously connected to the network. For example, if the computer is a laptop, the application will run the same way whether it's connected to the HQ network or out in the field.
  • Improved security. Since the application does not have to connect to a database server, there is no need to make "holes" in the corporate firewall for database network access. Since different data can be sent to different users, it can be arranged that no user could possibly see data not meant for him or her.

For more information about Cloudscape synchronization, see the Cloudscape Synchronization Guide.