Set user permissions
Within Db2 for IBM i, you require a user with the following permissions as a minimum:-
SQL
USAGEprivileges on the schemas containing the tables to be tracked:Where<schema>is the schema name and<streaming_user>is the user account name. -
SQL
SELECTprivileges on the tables to be tracked. This is to allow the snapshot phase to useSELECT * FROM ...with those tables:Where<schema>is the schema name,<table>is the table name, and<streaming_user>is the user account name. -
Read-only access to the journals that are being used to track streaming changes. You set this within the operating system terminal with the command:
Where
<schema>is the schema name,<jrn>is the journal name, and<streaming_user>is the user account name. -
Read-only access to the journal receivers that are being used to track streaming changes. The operating system command to grant access to all journal receivers associated with the journal is:
Where
<schema>is the schema name, and<streaming_user>is the user account name.
Configure journaling
The Db2 for IBM i connector initially queries the database to determine which journals capture the selected tables. When streaming, the connector will read from each of the relevant journal receivers. Use the following commands to set up journaling on tables for use with streaming where the table isn’t already being journaled.-
Create a journal receiver:
Where
<journal-receiver-name>is the name of the journal receiver, and<library>is the name of the library where it will be created. Read Create Journal Receiver (CRTJRNRCV) to learn more. -
Create the journal:
Where
<journal-name>is the name of the new journal, and<library>and<journal-receiver-name>are the values already used when creating the journal receiver. Read Create Journal (CRTJRN) to learn more. -
Start journaling for the desired files:
Where
<file>is the name of the file to be journaled, and<library>, and<journal-name>are the values already used when creating the journal.
IMAGES(*BOTH) when starting the journaling of a file, as shown in the above command.
Configure new tables
When adding tables to a pipeline, add them to the journal used to track streaming changes. Newly added tables capture changes from the time they are added. Historical data is not synchronized with the target. The pipeline immediately enters a STREAMING state. To capture historical data for a table, create a snapshot for that table.Migrating tables to a single journal
You may already have tables configured to be tracked by different journals—even though streaming currently only supports a single journal. You can change the journal associated with a table by running the following commands:-
End journaling for a table:
Where
<schema>is the schema name and<table>is the table name to end journal tracking for. -
Restart journal tracking for a table under a predefined journal:
Where
<schema>is the schema,<table>is the table name for the table we are moving to the journal, and<journal-name>is name of the journal that will record changes for the table going forwards.
Limitations
Multiple journals
The Db2 for IBM i connector does not support streaming across multiple journals. To stream data from tables in multiple journals, create separate pipelines, one pipeline per journal.Schema changes
The Db2 for IBM i connector might fail to process changes to journal entries if you alter the table’s structure when the connector isn’t active. To prevent such issues:- Only use the connector when the table’s schema is fixed.
- Only make schema modifications while the connector is running.

