@ -50,8 +50,8 @@ Notes
### Not support BOOLEAN type in SQL Replication on Db2
### Not support BOOLEAN type in SQL Replication on Db2
Only snapshots can be taken from tables with BOOLEAN type columns. Currently SQL Replication on Db2 does not support BOOLEAN, so Debezium can not perform CDC on those tables.
Only snapshots can be taken from tables with BOOLEAN type columns. Currently, SQL Replication on Db2 does not support BOOLEAN, so Debezium can not perform CDC on those tables.
Consider using a different type.
Consider using another type to replace BOOLEAN type.
How to create a Db2 CDC table
How to create a Db2 CDC table
@ -203,22 +203,24 @@ _Note: the mechanism of `scan.startup.mode` option relying on Debezium's `snapsh
### DataStream Source
### DataStream Source
```java
```java
import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.kafka.connect.source.SourceRecord;
import org.apache.flink.streaming.api.functions.source.SourceFunction;
import com.ververica.cdc.debezium.JsonDebeziumDeserializationSchema;
import com.ververica.cdc.debezium.JsonDebeziumDeserializationSchema;
import com.ververica.cdc.connectors.db2.Db2Source;
public class Db2SourceExample {
public class Db2SourceExample {
public static void main(String[] args) throws Exception {
public static void main(String[] args) throws Exception {
Db2Source< SourceRecord > db2Source = Db2Source.< SourceRecord > builder()
SourceFunction< String > db2Source =
Db2Source.< String > builder()
.hostname("yourHostname")
.hostname("yourHostname")
.port(yourPort )
.port(50000 )
.database("yourDatabaseName") // set captured database
.database("yourDatabaseName") // set captured database
.tableList("yourSchemaName.yourTableName") // set captured table
.tableList("yourSchemaName.yourTableName") // set captured table
.username("yourUsername")
.username("yourUsername")
.password("yourPassword")
.password("yourPassword")
.deserializer(new JsonDebeziumDeserializationSchema()) // converts SourceRecord to JSON String
.deserializer(
new JsonDebeziumDeserializationSchema()) // converts SourceRecord to
// JSON String
.build();
.build();
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
@ -226,13 +228,11 @@ public class Db2SourceExample {
// enable checkpoint
// enable checkpoint
env.enableCheckpointing(3000);
env.enableCheckpointing(3000);
env
env.addSource(db2Source)
.fromSource(db2Source, WatermarkStrategy.noWatermarks(), "Db2 Source")
.print()
// set 4 parallel source tasks
.setParallelism(1); // use parallelism 1 for sink to keep message ordering
.setParallelism(1)
.print().setParallelism(1); // use parallelism 1 for sink to keep message ordering
env.execute("Print Db2 Snapshot + Binlog ");
env.execute("Print Db2 Snapshot + Change Stream");
}
}
}
}
```
```