IBM InfoSphere CDC provides sample user exits that you can extend or modify to suit your environment. The samples are found in samples.jar which is located in the samples directory in your IBM InfoSphere CDC installation directory. The Java file contains the following samples:
▪ArchiveLogPathUserExitSample.java: Returns the fully qualified path (including file name and extension) to the archive log file. This sample is located in com.datamirror.ts.target.publication.userexit.sample.
▪CRUserExitSample.java: A conflict resolution user exit that can be used with tables having a primary key column of any data type or a numeric column with any data type. This sample is located in com.datamirror.ts.target.publication.userexit.cdr.
▪DEUserExitSample.java: Used in expressions using the %USERFUNC column function. It calculates the sum of the user-supplied parameters (in the expression) and returns the sum incremented by 1. This sample is located in com.datamirror.ts.derivedexpressionmanager.
▪SPUserExitSample.java: Calls a stored procedure with the image coming from the source. This sample is located in
▪UserExitSample1.java: Records new rows inserted into a table on the target and stores them in a text file. The user specifies the name of the text file as a parameter. This sample is located in
▪To run the sample user exits without modifying them, you must specify the fully qualified path to the compiled user exit in Management Console. For example:
▪Compiled sample user exits are located in the ts.jar file which is found in the lib directory in your IBM InfoSphere CDC installation directory. Note that the compiled user exits in the ts.jar file have a *.class extension.
▪If you want to modify the sample user exits, you must compile the user exit after you make changes to the source code.
▪The user exit class must also be in your classpath.
For more information about how to specify Java class or Stored Procedure user exits in Management Console, see your Management Console documentation.
To compile the sample user exits (Windows)
1 Stop IBM InfoSphere CDC.
2 Unzip the samples.jar file into the lib folder in your IBM InfoSphere CDC installation folder. Make sure you maintain the folder structure when unzipping the jar file.
3 After unzipping the jar file, you will have a folder structure like the following:
5 Compile the modified user exit. For example, if you want to compile UserExitSample.java, open a command window, navigate to the lib folder and issue the following command:
For more information about how to specify Java class user exits in Management Console, see your Management Console documentation.
If you plan to use the sample user exits in production environments, you must test the samples before they are deployed. UNICOM Systems, Inc. does not assume responsibility for adverse results caused by modified or customized user exit classes.
To compile the sample user exits (UNIX and Linux)
1 Stop IBM InfoSphere CDC.
2 Unzip the samples.jar file into the lib directory in your IBM InfoSphere CDC installation directory. Make sure you maintain the directory structure when unzipping the jar file.
3 After unzipping the jar file, you will have a directory structure like the following:
5 Compile the modified user exit. For example, if you want to compile UserExitSample.java, open a command window, navigate to the lib directory and issue the following command:
For more information about how to specify Java class user exits in Management Console, see your Management Console documentation.
Note If you plan to use the sample user exits in production environments, you will have to test the samples before they are deployed. IBM does not assume responsibility for adverse results caused by modified or customized user exit classes.