This article highlights some of the important changes in IBM Cloudscape Version 10, also known as the Derby release. Among the notable new changes is that Cloudscape V10 is now an IBM DB2® compatible database. In addition, some important changes affect the configuration of IBM WebSphere Application Server V6. These changes will be the focus of this article.
As of the writing of this article, the IBM WebSphere Application Server V6 software support site does not explicitly list Cloudscape V10 as one of its supported databases (due to the late announcement of the Cloudscape release). However, Cloudscape V10 should be supported by WebSphere Application Server V6 as an "Other Configuration", as defined by the support statement. Cloudscape V10 is expected to be officially supported in an upcoming release of WebSphere Application Server.
Changes that affect WebSphere Application Server configuration
Several changes have been made to Cloudscape V10 that affect how WebSphere Application Server V6 should be configured.
Cloudscape V10 has new package names that will enable it to coexist in the same WebSphere Application Server environment with a previous version of Cloudscape (such as, Cloudscape 5.1.60). The new package names have been changed from com.ibm.db2j.* to org.apache.derby.*. The new package names are:
org.apache.derby.drda
org.apache.derby.jdbc
org.apache.derby.tools
Other naming changes include:
db2j.propertiesfile has been changed toderby.propertiesdb2j.system.homehas been changed toderby.system.home.
Cloudscape V10 is a DB2 compatible database, with compatibility in the following areas:
- Data Definition Language (DDL) and Data Manipulation Language (DML)
Cloudscape V10 DDL and DML are subsets of DB2's. - Error codes and SQLStates
The most common SQLStates and error codes have been changed in Cloudscape V10 to match those of DB2. For example:
Users will benefit greatly from the standards-based features in Cloudscape V10, since it enables users to develop applications against Cloudscape V10 in a development environment, deploy in a small-to-medium-sized production environment, and then run against DB2 in the enterprise environment.Previous code New code Description 2300023502Column {0} cannot accept a NULL value. 2350023505The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by {0} defined on {1}. 23L01235052350123503Descr{2} on table {1} caused a violation of foreign key constraint {0} for key {3}. The statement has been rolled back.iption 23L0223513The check constraint {1} was violated while performing an INSERT or UPDATE on table {0}. 42X1142622The name {0} is too long. The maximum length is {1}. 42X1842818Comparisons between {0} and {1} are not supported. 42X4242821Columns of type {0} cannot hold values of type {1}. This error can occur with user-defined classes if they are not in the class path. 42Y1842846Cannot convert types {0} to {1}. XJZZZ0A000Feature not implemented: {0}.
See Migrating IBM Cloudscape for a complete list of changes between Cloudscape V5.1 and Cloudscape V10.
Install Cloudscape V10 in the WebSphere Application Server V6 environment
To install Cloudscape V10 in a WebSphere Application Server V6 environment:
- Unzip the provided
derbyInstall.zipdownload file into theWAS_HOMEdirectory (where WebSphere Application Server is installed, for examplec:\Program Files\WebSphere\AppServer), as follows:- Copy the
derbyInstall.zipfile to${WAS_HOME}. - Enter the command
cd ${WAS_HOME}. - Unzip
derbyInstall.zip.
- Copy the
- Download Cloudscape V10 JAR files into
${WAS_HOME}\derby\lib, as follows:- Locale files go to
${WAS_HOME}\derby\lib\locales. db2jcc.jargoes to${WAS_HOME}\derby\lib\otherJars.derbytools.jar,derby.jar,derbynet.jar, anddb2jcc_license_c.jargo to${WAS_HOME}\derby\lib.
- Locale files go to
- Modify
${WAS_HOME}\bin\setupCmdLine.bat/shand add:- For Windows®:
SET DERBY_HOME=%WAS_HOME%\derby. - For UNIX® or Linux®:
DERBY_HOME="$WAS_HOME"/derby.
- For Windows®:
Figure 1. Derby directory structure
You should now be able to run the same commands in Cloudscape V10 that you did in Cloudscape 5.1 (such as, ij, startNetworkServer, stopNetworkServer, and so on). Be aware that cview.sh/bat does not appear, as Cloudscape has ended support for this tool.
Configure WebSphere Application Server V6 for Cloudscape V10
Configuring WebSphere Application Server V6 to run against Cloudscape Version 10, you first need to configure a Java™ Database Connectivity (JDBC) provider for the new version of Cloudscape, then configure data sources for the new JDBC provider.
Configure a JDBC provider for Cloudscape V10
As always, the first step for running against a database is to configure a JDBC provider for the application server. There are three different providers that can be configured in WebSphere Application Server V6 for Cloudscape V10:
- Configure a JDBC provider for Cloudscape V10
- Log on to the WebSphere administrative console (at
http://localhost:9060/ibm/console). - Select Resources => JDBC Providers, then Scope => Server. Click Apply then New (Figure 2).
Figure 2. Admin console
- On the New JDBC provider dialog (Figure 3), select the following values:
- Step 1: Cloudscape
- Step 2: Cloudscape JDBC Provider
- Step 3: Connection pool data source
Figure 3. New JDBC provider
- On the Embedded JDBC provider dialog (Figure 4), enter values for the following fields:
- Name (optional but recommended)
- Description (optional)
- Class path (required): must point to the new CloudscapeV10 JAR file (such as,
${WAS_INSTALL_ROOT}/derby/lib/derby.jar) - Implementation class: enter
org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource
Figure 4. Cloudscape V10 Embedded JDBC Provider
- Log on to the WebSphere administrative console (at
- Configure a Cloudscape embedded JDBC provider (XA)
- Log on to the WebSphere administrative console (at
http://localhost:9060/ibm/console). - Select Resources => JDBC Providers, then select scope. Click Apply then New.
- On the New JDBC provider dialog (Figure 5), select the following values:
- Step 1: Cloudscape
- Step 2: Cloudscape JDBC Provider
- Step 3: XA data source
Figure 5. New JDBC provider
- On the next dialog (Figure 6), enter values for the following fields:
- Name (optional but recommended)
- Description (optional)
- Class path (required): must point to the new Cloudscape V10 JAR file (such as,
${WAS_INSTALL_ROOT}/derby/lib/derby.jar) - Implementation class: enter
org.apache.derby.jdbc.EmbeddedXADataSource
Figure 6. JDBC provider configuration
- Log on to the WebSphere administrative console (at
- Configure a Cloudscape Network Server JDBC provider
- Log on to the WebSphere administrative console (at
http://localhost:9060/ibm/console). - Select Resources => JDBC Providers, then select scope. Click Apply then New.
- On the New JDBC provider dialog (Figure 7), select the following values:
- Step 1: Cloudscape
- Step 2: Cloudscape Network Server Using Universal JDBC Driver
- Step 3: connection pool data source
Figure 7. New JDBC provider
- On the next dialog (Figure 8), modify the description (optional), then replace the
db2j.jarentry in the Class path withderby.jar, which is the new Cloudscape V10 JAR. The value of Class path should then look something like:
Select Apply.${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar ${CLOUDSCAPE_JDBC_DRIVER_PATH}/otherJars/db2jcc.jar ${WAS_INSTALL_ROOT}/derby/lib/derby.jar ${UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.ja
Figure 8. JDBC provider configuration
- Log on to the WebSphere administrative console (at
Configure data sources for the new JDBC provider
To create and define a WebSphere data source:
- Log on to the WebSphere Application Server admin console at
http://localhost:9060/admin. - Select Resources => JDBC providers, then scope and Apply.
- Select the JDBC provider created above.
- Under "Additional Properties", select Data sources => New to create a new data source.
- The most important section in the page that displays is the "Data store helper class name" where a user-defined data store helper needs to be created and defined, as described below.
- Define the component-managed or container-managed authentication alias, as your application requires, as described below. An alias definition is only required if running Cloudscape V10 Network Server framework.
- Select OK and Save.
Create an authentication alias
To create an authentication alias (if none are defined in the drop-down list):
- From the WebSphere Application Server admin console, select Security => Global security => JAAS Configuration => J2C Authentication Data => New.
- Enter values for the Alias, User ID, and Password fields.
- Select OK, then Save the configuration.
Create a new data store helper
Since some of the exception errorCodes and SQLStates have changed in Cloudscape V10, a user-defined data store helper needs to be created and defined in WebSphere Application Server to include the new mapping for StaleConnectionExceptions and DuplicateKeyExceptions. To create a new user-defined data store helper:
- Create a class that extends
com.ibm.websphere.rsadapter.CloudscapeDataStoreHelper(Listing1) orcom.ibm.websphere.rsadapter.CloudscapeNetworkServerDataStoreHelper(Listing 2). - Compile the newly created DataStoreHelper class(es). You will need the following JAR files in your classpath to compile them (all located in
{WAS_HOME}/lib):utils.jarj2ee.jarrsaexternal.jar.
- Create a JAR file of the compiled class(es) and put them in
{WAS_HOME}/lib/ext.
Now that the data store helpers have been created, you need to configure them in the WebSphere data source created above. See Figure 9 or, in the case of NetworkServer, Figure 10, for an example of how they get set.
Listing 1. Embedded (xa and non-xa) user-defined helper
package myCompany.helper;
import java.util.Properties;
import com.ibm.websphere.ce.cm.DuplicateKeyException;
import com.ibm.websphere.rsadapter.CloudscapeDataStoreHelper;
public class MyDerbyDataStoreHelper extends CloudscapeDataStoreHelper
{
//static final long serialVersionUID = ;
//to be generated by user
public MyDerbyDataStoreHelper(Properties props)
{
super(props);
java.util.HashMap myErrorMap = new java.util.HashMap(3);
myErrorMap.put("23505", DuplicateKeyException.class);
myErrorMap.put("23500", Void.class);
myErrorMap.put("23L01", Void.class);
setUserDefinedMap(myErrorMap);
}
} |
Listing 2. Network Server user-defined helper
package myCompany.helper;
import java.util.Properties;
import com.ibm.websphere.ce.cm.DuplicateKeyException;
import com.ibm.websphere.ce.cm.StaleConnectionException;
import com.ibm.websphere.rsadapter.CloudscapeNetworkServerDataStoreHelper;
public class MyDerbyNetworkServerDataStoreHelper extends CloudscapeNetworkServerDataStoreHelper
{
//This value should change only if the class evolves to an incompatible class.
//static final long serialVersionUID = ;
//to be generated by user
public MyDerbyNetworkServerDataStoreHelper(Properties props)
{
super(props);
java.util.HashMap myErrorMap = new java.util.HashMap(4);
myErrorMap.put("23505", DuplicateKeyException.class);
myErrorMap.put("23500", Void.class);
myErrorMap.put("23L01", Void.class);
myErrorMap.put(new Integer(-4499), StaleConnectionException.class);
setUserDefinedMap(myErrorMap);
}
} |
Figure 9. Define a user-defined data store helper
Figure 10. Define a user-defined data store helper in a network server
Deploy a Cloudscape V10 application
When deploying an application that uses Cloudscape V10 in WebSphere Application Server V6, you must select DB2UDB_V81 as the database type. This is the only difference between deploying an application using Cloudscape V10 versus Cloudscape 5.1. Figure 11 shows how you can do this from the admin console. (Since you are deploying with DB2UDB_V81 instead of specifically to a Cloudscape V10 database schema, it is possible that a limitation may prevent the generated deployed code from running with Cloudscape V10 in CMP (container managed persistence) cases only. Note, however, that the possibility of such a problem is small, since Cloudscape generated code is very close to DB2's generated code.)
Figure 11. Perform EJB deployment from the admin console
This article described some of the major changes made in IBM Cloudscape Version V10 that affect WebSphere Application Server, explained how to install this new version in WebSphere Application Server V6.0, how to configure WebSphere Application Server so that it can run with Cloudscape V10, and how to deploy an application to run in Cloudscape V10. Most of the information described in this article applies only to WebSphere Application Server V6.
| Description | Name | Size | Download method |
|---|---|---|---|
| Derby installation files | derbyInstall.zip | 10 KB | FTP |
Information about download methods
- Cloudscape Version 10.0: A technical overview
- WebSphere Application Server supported hardware and software
- WebSphere Application Server clarification of configurations support
- IBM developerWorks DB2 Cloudscape
- Migrating IBM Cloudscape
- To learn more, visit the developerWorks WebSphere Application Server zone for technical documentation, how-to articles, education, downloads, product information, technical support resources, and more.
- Browse for books on these and other technical topics.
- WebSphere forums.
Product-specific forums where you can ask questions and share your opinions with other WebSphere users.
- developerWorks blogs. Ongoing, free-form columns by software experts, with space for you to add your comments.
Soloman Barghouthi is an Advisory Software Engineer at the IBM Rochester Lab. Soloman started his career at IBM working as a developer on the San Francisco project, and is currently a developer on the WebSphere Connection Management team. Soloman is a database expert, the Oracle resident, and has deep knowledge in DB2. Soloman is responsible for how Cloudscape and Oracle operate in WebSphere.




