Use the Change Data Capture functions
to control the data capture process. Process CDC records to extract
the data. Query syscdc tables to retrieve the symbolic names
and descriptions of CDC records and errors.
Before you begin
Complete the prerequisite tasks to prepare for using the Change Data Capture API.
Your
application should contain the following structures and functions:
A structure to store table schema information. You use the table
schema to parse the column data.
A function to interpret the table schema information and populate
the table schema structure. You can obtain the table schema information
from the CDC_REC_TABSCHEMA record.
A function to retrieve and parse the column values from the data
buffer.
A function to handle errors. You can query the syscdcerrcodes table
to determine the symbolic name and description of the error code.
About this task
Include the following tasks in your application to capture
data changes:
Procedure
As user informix, connect to the syscdcv1 database
on the database server to which the client is currently connected.
Open a capture session by running the cdc_opensess() function.
The cdc_opensess() function returns
a session ID.
Enable full-row logging for each table from which you want
to capture data by running the cdc_set_fullrowlogging() function.
Specify which data to capture by running the cdc_startcapture() function.
Run this function for each table from which you want to capture
data.
Start the capture process by running the cdc_activatesess() function.
CDC records, including those that contain captured data,
are returned to the application.
Read the CDC records containing captured data with a smart
large object read function such as mi_lo_read() by
passing the session ID as the large object file descriptor.
Use
the same smart large object read function for all read calls.
Parse the data by column values.
If
you are writing your application in Java™,
you can use the IfxToJavaType class to convert a byte stream of the HCL
OneDB™ representation
of a data type to the appropriate Java data
type and value.
Stop capturing data by running the cdc_endcapture() function
for each table.
Disable full-row logging by running the cdc_set_fullrowlogging() function
for each table.
Make sure that no other applications or
processes are dependent on full-row logging before your disable it.
Close the capture session by running the cdc_closesess() function.
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.