DB2 (Native)
Version 25.3.9414
Version 25.3.9414
DB2 (Native)
CData Sync アプリケーションからDB2 コネクタを使用して、DB2 からデータを取得してサポートされている任意の同期先に移動できます。これを行うには、コネクタを追加し、コネクタへの認証を行い、接続を完了する必要があります。
Prerequisites
Before you add and set up the DB2 source connector, you need to set up the DB2 database for enhanced change data capture (CDC), as explained in the following sections.
Requirements
Before you set up DB2 for enhanced CDC, ensure that you have DB2 11.5 or later.
Sync enhanced CDC uses DB2 SQL replication technology, which depends on Abstract Syntax Notation (ASN) libraries. These libraries are essential for operation and require an IBM InfoSphere Data Replication (IIDR) license. However, IIDR installation is not necessary.
Set Up DB2 for Enhanced CDC
Before you add your DB2 connector, you need to enable change data capture (CDC) in the database and put your tables in capture mode, as follows:
-
Log in to DB2 as the db2inst1 user.
-
Enable (start) the ASN agent (capture program), create the schema where all captured table changes will be stored, and add the tables for which you want to capture changes, as follows. These steps are based on the DB2 portions of the IBM SQL Replication Guide and Reference.
-
Download the defined functions from the User-Defined Functions (UDF) link [??????TO BE PROVIDED????] and add them to your DB2 server directory (for example,
$HOME/asncdctools/src).The DB2 server’s PATH environment variable contains the DB2 path to the
bldrtncommand (for example,export PATH=$PATH:/opt/ibm/db2/V11.5.0.0/samples/c/command appends the directory /opt/ibm/db2/V11.5.0.0/samples/c/ to the existing PATH variable). As a result, you can run thebldrtncommand from anywhere in your terminal without specifying the full path. Use this command to compile the UDFs, as shown below:cd $HOME/asncdctools/src bldrtn asncdc -
Make sure that the JDBC driver can read the DB2 metadata catalog by submitting the following commands:
# Replace the {...} placeholders as required cd $HOME/sqllib/bnd db2 connect to YourDatabaseName db2 bind db2schema.bnd blocking all grant public sqlerror continue -
Ensure that the database was recently backed up. The ASN agents must have a recent starting point from which to read. If you need to perform a backup, run the following commands:
db2 backup db YourDatabaseName to YourBackupLocation db2 restart db YourDatabaseNameThese commands trim (prune) the data so that only the most recent version is available. If you do not need to retain older versions of the data, specify
dev/nullfor the backup location. -
Connect to your DB2 database to install the UDFs. Log in as the db2inst1 user and execute the following commands:
db2 connect to YourDatabaseName cp $HOME/asncdctools/src/asncdc $HOME/sqllib/function chmod 777 $HOME/sqllib/function -
Enable the functions that will start and stop the ASN capture agent.
db2 -tvmf $HOME/asncdctools/src/asncdc_UDF.sql -
Create the ASN control tables.
db2 -tvmf $HOME/asncdctools/src/asncdctables.sql -
Create the functions that will be used to add control table to or remove them from capture mode.
db2 -tvmf $HOME/asncdctools/src/asncdcaddremove.sql
-
-
Create a connection with your database. Then, enable the DB2 ASN capture agent and add tables for capture mode.
-- start the ASN agent VALUES ASNCDC.ASNCDCSERVICES('start','asncdc'); --- add a table to capture mode CALL ASNCDC.ADDTABLE('SchemaName', 'TableName'); CALL ASNCDC.ADDTABLE('DB2INST1', 'TEST_TABLE'); ---------------------------------------------------- -- Other commands that you can use: -- Reinitiate or stop the ASN agent VALUES ASNCDC.ASNCDCSERVICES('reinit','asncdc'); VALUES ASNCDC.ASNCDCSERVICES('stop','asncdc'); -- check the status of the ASN agent VALUES ASNCDC.ASNCDCSERVICES('status','asncdc'); -- remove a table from the change data capture mode: CALL ASNCDC.REMOVETABLE('SchemaName', 'TableName');
For details about using enhanced CDC, see Enhanced CDC Jobs in CData Sync.
DB2 コネクタを追加
Sync でDB2 のデータを使用できるようにするには、まず以下の手順でコネクタを追加する必要があります。
-
Sync のダッシュボードから接続ページを開きます。
-
接続を追加をクリックしてコネクタを選択ページを開きます。
-
データソースタブをクリックしてDB2 (Native) 行に移動します。
-
行末にある接続を設定アイコンをクリックして、新しい接続ページを開きます。接続を設定アイコンが利用できない場合は、コネクタをダウンロードアイコンをクリックしてDB2 (Native) コネクタをインストールします。新規コネクタのインストールについて詳しくは、接続を参照してください。
DB2 への認証
コネクタを追加したら、必須プロパティを設定する必要があります。
-
Connection Name - Enter a connection name of your choice.
-
Server - Enter the address or host name of the DB2 (Native) server. The default server is localhost.
-
Port - Enter the port on which your DB2 server is listening. The default port is 50000.
-
Database - Enter the name of your DB2 (Native) database.
-
User - Enter the username that you use to authenticate to the DB2 (Native) database.
-
Password - Enter the password that you use to authenticate to the DB2 (Native) database.
Complete Your Connection
To complete your connection:
-
高度な設定タブで接続の高度な設定を定義します。(ただし、ほとんどの場合これらの設定は必要ありません。)
-
作成およびテストをクリックして接続を作成します。