Target Adapter Version 2.4.1
 —  Installing and Using the Event Replicator Target Adapter  —

Event Replicator Target Adapter Overview

The Event Replicator Target Adapter can be used to transform and apply replicated data to a relational database, such as DB2, MySQL, Oracle, SQL Server, Sybase, or Teradata.

Note:
Event Replicator Target Adapter only supports replicating data to one relational database at a time.

This document covers the following topics:


How It Works

This section covers the following topics:

Requirements

The Event Replicator Target Adapter requires the use of:

For more information on Event Replicator for Adabas subscription and destination definitions, read Definition Descriptions.

General Processing

When a subscription definition and one or more of its associated destination definitions have been defined in the manner described in Requirements and if they are activated, the Event Replicator for Adabas automatically creates a schema that maps the replicated data.

The Event Replicator Target Adapter uses the schema to transform and apply the replicated data to your relational database. It will dynamically create tables if they don't exist and populate the tables with Adabas data using insert, update, and delete processing as these processes occur in near real-time in the replicated Adabas file. For more information about activating the Event Replicator Target Adapter, read Activating Event Replicator Target Adapter Processing.

Event Replicator for Adabas and Event Replicator Target Adapter high-level processing are depicted in the following diagram.

graphics/art_proc.png

The Adabas data is replicated as usual by the Event Replicator using a subscription with Event Replicator Target Adapter processing activated. The subscription transforms the replicated data and creates a schema from the generated field table. The schema and the transformed replicated data are then sent to the Event Replicator Target Adapter. The Event Replicator Target Adapter then processes the data and populates and creates appropriate tables in the RDBMS, as described next in Table Structure.

Table Structure

Event Replicator Target Adapter creates and populates tables with replicated data in the RDBMS as follows:

MU and PE Field Support

MU and PE fields are supported by the Event Replicator Target Adapter:

You can control how many occurrences of PE and MU fields are generated in the global format buffer field table, and thus, how many occurrences are available for Event Replicator Target Adapter processing. This is accomplished using a combination of the Predict Occ field attribute setting and the Occurrences used setting specified when the global format buffer field table is generated. By altering the Occurrences used setting, you can specify that the maximum number of occurrences be generated, that no additional occurrences be generated, or that the number of occurrences defined by the Predict Occ attribute should be generated. For more information about the Occ field attribute, refer to your Predict documentation.

For more information about generating a global format buffer field table, read either Generating a GFB using the Adabas Event Replicator Subsystem or Generating a GFB using Event Replicator Administration.

By default, when MU or PE fields are included in the replicated data, additional tables are created, as follows:

Field Type Tables Generated
MU A new MU table is generated for each MU field. Each value of the MU field will be a row in the MU table.

The name of the MU table is comprised of the name of the root table (for example, PAYROLL_EMPLOYEE_ADDRESS-LINE) and the column name of the MU field.

The MU table will consist of two columns:

  • The reference key will be made up of the root table primary key, or if there is no primary key, the ISN will be used.

  • The MU column name may be defined as an index.

PE One table is generated for a PE group field. The elements that comprise the PE group field become columns in the table. For example, if the PE field consists of five subfields, five columns are created.

The name of the PE table includes the name of the PE field (for example PAYROLL_EMPLOYEE_INCOME). The columns in the table are given the subfield names.

Using the Data Mapping Tool, you can flatten MU and PE fields in the replicated data so that they are replicated as columns in the resulting table, rather than as separate tables. For more information, read Selecting MU and PE Field Replication Methodology.

RDBMS Recovery Processing

If the RDBMS is not operational when the Event Replicator Target Adapter starts, the Event Replicator Target Adapter terminates.

If, at any time during normal Event Replicator Target Adapter processing, the Event Replicator Target Adapter detects that the RDBMS is not operational, it will attempt to reconnect to the database at an interval specified by the retryInterval environment entry. The number of times it attempts to reconnect to the database is determined by the setting of the retryCount environment entry. You can set the values for these environment entries, as described in Configuring the Messaging System for Event Replicator Target Adapter. If you use the default settings of these environment entries, the Event Replicator Target Adapter will attempt to reconnect to the RDBMS database every 30 seconds for a total of five attempts.

If a reconnect attempt is successful, Event Replicator Target Adapter processing continues normally. If, however, all of the reconnect attempts fail, the Event Replicator Target Adapter will terminate. When it terminates, the unprocessed messages remain in the message queue, so no transactions are lost. The Event Replicator Target Adapter will not remove a transaction from the message queue unless its associated transaction has been successfully committed to the RDBMS database.

If a SQL error is detected in a given transaction, by default the Event Replicator Target Adapter will write the transaction to the sqlrep.log file and terminate. However, you can change the value of an environment entry, called sqlerrorcontinue, that logs the error, but allows Event Replicator Target Adapter to continue processing. For more information about error processing, read Managing Event Replicator Target Adapter Log Files. For more information about the environment entries, read Configuring the Messaging System for Event Replicator Target Adapter .

Top of page

What You Can Do

Once appropriate Event Replicator subscription and destination definitions are activated and the Event Replicator Target Adapter is started, normal processing for the Event Replicator Target Adapter will transform and apply replicated data to a relational database as the data is processed by the subscription. In addition, using the Adabas Event Replicator Subsystem or Event Replicator Administration, you can manually submit requests to the Event Replicator Target Adapter that:

For information on using the Adabas Event Replicator Subsystem to do this, read Submitting Event Replicator Target Adapter Requests. For information on using Event Replicator Administration to do this, read Submitting Event Replicator Target Adapter Requests.

In addition, you can set up the ADALOD utility so that data loaded or updated by the utility is also replicated to the relational database tables. However, read Replicating ADALOD Data to the RDBMS Tables for important information on problems that might arise when you do this.

Top of page

Data Type Conversions

The following table describes the data type conversions used by Event Replicator Target Adapter during its processing.

Event Replicator Data Type JDBC Data Types RDBMS Data Types
DB2 MySQL Oracle SQL Server Sybase
binary (length less than or equal to 8) decimal decimal(22) number(22) numeric(22)
binary (length greater than 8) varchar varchar varchar2(len*2) varchar
date date date datetime
decimal (with precision) decimal decimal(len+pre, pre) number(len+pre, pre) decimal(len+pre, pre)
decimal (without precision) decimal decimal(len) number(len) numeric(len)
float float float
integer integer integer
string varchar varchar varchar varchar2 varchar varchar
time time timestamp datetime timestamp datetime

Top of page

Character Encoding Considerations

XML data sent to Event Replicator Target Adapter is in EBCDIC character encoding. However, support for UTF-8 encoding of the RDBMS data (not table or column names) is available for internationalization purposes. To send XML messages to Event Replicator Target Adapter using UTF-8 format, make sure the SACODE parameter is set to "4091" in the Event Replicator subscription definition used for Event Replicator Target Adapter processing.

Wide-character fields sent to Event Replicator Target Adapter are translated to hexadecimal. However, support for UTF-8 encoding is available for internationalization purposes. To send wide-character fields to Event Replicator Target Adapter using UTF-8 format, make sure the SWCODE parameter is set to "4091" in the Event Replicator subscription definition used for Event Replicator Target Adapter processing.

For more information about these parameters, read SACODE Parameter and SWCODE Parameter.

Note:
If you want to use UTF-8 character encoding, you must verify that your GFB field lengths are increased as required to accommodate the character set referenced by the code page you select and the data requested in the GFB. You can increase these field lengths manually by editing the GFB itself or by editing the Predict file or data definition module (DDM) used when the GFB is generated.

Top of page

Samples

A sample of a generated field table, its corresponding XML schema, some replicated data, and the resulting SQL table are provided in Samples.

Top of page

Getting Started

Start of instruction setTo get started using the Event Replicator Target Adapter:

  1. Install the Event Replicator Target Adapter, as described in Installing the Event Replicator Target Adapter.

    Make sure you address any Event Replicator Target Adapter installation considerations provided for your relational database, as described in Step 2 of the Event Replicator Target Adapter installation.

  2. Configure the Event Replicator Target Adapter, as described in Configuring the Messaging System for Event Replicator Target Adapter and Configuring the RDBMS Databases for Event Replicator Target Adapter.

  3. Start the Event Replicator Target Adapter, as described in Starting the Event Replicator Target Adapter.

  4. Edit the Event Replicator subscriptions you want used to transform and submit data to the Event Replicator Target Adapter. For each subscription, verify that:

    Be sure to save the subscription definitions and any destination definitions you modified.

    For more information on Event Replicator for Adabas subscription, SFILE, GFB, and destination definitions, read Definition Descriptions.

  5. Activate the subscription and destination definitions. To activate subscription and destination definitions using Adabas Online System (AOS), read Managing Replication Definitions from AOS. To activate subscription and destination definitions using Event Replicator Administration, read Activating and Deactivating Subscription Definitions and Activating and Deactivating Destination Definitions.

Top of page