Using function strings to replicate Java columns to older Replication Servers

Replication Server version 12.0 does not propagate replication definitions with Java datatypes to pre-12.0 Replication Servers. However you can replicate Java columns through older Replication Servers if you use the corresponding base datatype (image and varbinary(255)) and manipulate the rs_usedb and rs_insert function strings.

The following example illustrates the method.

  1. Create tables containing Java columns in the primary and replicate databases:

    create table tInfo
        (c1 integer,
        c2 Name rawobject in row,
        c3 Address rawobject null,
        c4 AccountInfo rawobject not null)
    

    Name, Address, and AccountInfo are Java classes; c2, c3, and c4 are Java columns.

  2. Create a replication definition for table tInfo.

    If at least one of the Replication Server is pre-12.0, you must create a replication definition using the base datatypes for rawobject in row (varbinary(255)) and rawobject (image):

    create replication definition tInfo1
    with primary at DS-1.dbase
    with all tables name TInfo
    (c1 integer,
    c2 varbinary(255),
    c3 image null,
    c4 image not null,
    primary key (c1)
    ...
    

    If the primary and replicate databases are managed by Replication Servers version 12.0 or later, a replication definition could be:

    create replication definition tInfo
    with primary at DS-1.dbase
    with all tables named tInfo
        (c1 integer,
        c2 rawobject in row,
        c3 rawobject null,
        c4 rawobject not null)
        primary key (c1)
        ...
    
  3. Alter the rs_usedb and rs_insert function strings for both the primary and replicate database connections. Refer to “Altering function strings” on page 42 in the Replication Server Administration Guide Volume 2 for general information about customizing function strings.

So, you can create two replication definitions for the same table where the columns between the two replication definitions have different primary (declared) datatypes. If the primary Replication Server is version 12.0 or later, you can create both replication definitions tInfo and tInfo1 for table tInfo. In this case, replicate Replication Servers version 12.0 and later can subscribe to tInfo and Replication Servers version pre-12.0 can subscribe to tInfo1.

NoteYou cannot use this method to replicate Java columns to standby databases. The standby connection uses the function-string class rs_default_function_class, which cannot be altered.