The cdc_opensess() function

Opens a capture session and creates a session ID.

A row is inserted into the syscdcsess table for the session.

Syntax


1  cdc_opensess ( " server_name " , session_ID , timeout ,  max_recs , major_version , minor_version )

Function arguments

Table 1. The cdc_opensess() arguments
Argument Data Type Description
server_name LVARCHAR The name of the server. Must be the server to which the client application that is calling the cdc_opensess() function is connected.
session_ID INTEGER Must be 0.
timeout INTEGER Specifies the timeout behavior of a read call on the captured data:
<0
Do not timeout.
0
Return immediately if no data is available.
1 or more
The number of seconds to wait for data before timing out.
max_recs INTEGER The maximum number of CDC records to return per read function call. This value takes precedence over the maximum number of bytes to return that is specified in the smart large object read function.
major_version INTEGER The major version number of the Change Data Capture API. Must be 1.
minor_version INTEGER The minor version number of the Change Data Capture API.

Must be 1 for new applications.

Can be 0 for existing applications.

Usage

Use the cdc_opensess() function to open a communication session between the client application and the database server. The session ID returned by the cdc_opensess() is the smart large object file descriptor that you supply to the smart large object read function. To start capturing data, you must then use the cdc_activatesess() function and the cdc_startcapture() function.

You must call this function from a client application. You cannot call this function from a user-defined routine that runs within the database server.

Important: If you have multiple applications that use the Change Data Capture API and connect to the same HCL OneDB™ server, all applications must use the same values for the major_version and minor_version arguments.

Return values

If successful, returns an integer that is the session ID.

If unsuccessful, returns an integer corresponding to an error code.