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.
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.
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) ...
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.
For rs_usedb:
alter function string rs_usedb for function_string_class_name output language ‘use ?rs_destination_db!sys_raw? set raw_object_serialization on’
This change tells Adaptive Server to return Java column data as serialized binary values at subscription materialization. It also allows Replication Server to insert and update Java columns with serialized binary values.
For rs_insert:
alter function string tInfo1.rs_insert for function_string_class_name output language ‘insert tInfo(c1, c2, c4) values (?c1!new?, ?c2!new?, 0xaced000574000130)’
This change alters rs_insert for tInfo1 to insert the special binary value 0xaced000574000130 in column c4. If you do not alter rs_insert, the default value may cause Adaptive Server to return a serialization error.
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.
You 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.