Configuring Java CAPS JBI Components for GlassFish Clustering

Configuring the Database Binding Component for Clustering

The Database BC works differently in inbound mode than outbound mode in a cluster. In inbound mode, the database BC distributes records evenly across the instances based on the number of records configured for each poll. For inbound mode, you need to create database tables to manage the instances. In outbound mode, the Database BC works the same in a clustered environment as in a standalone environment.

The Database BC is not dependent on any shared libraries.

Creating the Clustering Database for the Database Binding Component

When using the Database BC in inbound mode in a clustered environment, you need to create a clustering database to manage the load. This is not required for outbound mode.

ProcedureTo Create the Clustering Database for the Database Binding Component

Before You Begin

Create a database instance in which to create the clustering database tables, and make sure it is running.

  1. Run the following SQL command against the database for each polling table, updating the variables for each table.

    create table owner_polling_table (pkname datatype(size) primary key, instance_name varchar(50), status varchar(30))

    where:

    • polling_table is the name of the polling table

    • pkname is the name of the polling table's primary key

    • datatype is the data type for the primary key

    • size is the length of the primary key column

  2. Run the following command against the database:

    create table instancestate (instanceid varchar(50), lastupdatetime timestamp, tablename varchar(50))

  3. Create and configure a connection pool for the database (for more information, see Chapter 3, JDBC Resources, in Sun GlassFish Enterprise Server 2.1 Administration Guide).

  4. Create and configure a JDBC resource for the database. When you create the JDBC Resource, select the cluster from the Available Targets list and click Add.

    This adds the resource to the cluster and also enables the resource on the cluster.

Adding the Database Binding Component to the Cluster

The Database BC does not depend on any shared libraries, so you only need to add the BC to the cluster.

ProcedureTo Add the Database Binding Component to the Cluster

  1. Add the Database BC to the cluster as described in To Add a Java CAPS JBI Component to a Cluster.

    The name of the Database BC node is sun-database-binding.

  2. Before you click OK on the Manage Targets page, configure the runtime properties:

    • Enter the number of outbound threads.


      Note –

      When using a Derby database, be sure to set this to a relatively high number (for example, 100 per 1000 records) or create all cluster-related tables in the same database. Otherwise, a SQL exception may be thrown and the database will become unusable.


    • In the Cluster Database JNDI Name property, enter the name of the JDBC resource you created earlier (in To Create the Clustering Database for the Database Binding Component.