我在我的 java 应用程序中使用 debezium 来捕获来自 Oracle 12c 的更改。可以在 localhost:1521 上访问 oracle 数据库。下面是各自的java代码。
// Define the configuration for the embedded and Oracle connector ...
Configuration config = Configuration.create()
.with("connector.class", "io.debezium.connector.oracle.OracleConnector")
.with("tasks.max", "1")
.with("offset.storage",
"org.apache.kafka.connect.storage.FileOffsetBackingStore")
.with("offset.storage.file.filename",
"/home/username/oracleLogs/offset.dat")
.with("offset.flush.interval.ms", 10000)
.with("name", "oracle-debezium-connector")
.with("database.hostname", "localhost")
.with("database.port", "1521")
.with("database.user", "c##xstrm")
.with("database.password", "xs")
.with("database.sid", "ORCLCDB")
.with("database.server.name", "oracle-debezium-server")
.with("database.out.server.name", "dbzxout")
.with("database.history",
"io.debezium.relational.history.FileDatabaseHistory")
.with("database.history.file.filename",
"/home/username/oracleLogs/dbhistory.dat")
.with("database.dbname", "ORCLCDB")
.with("database.pdb.name", "ORCLPDB1")
.build();
// Create the engine with this configuration ...
EmbeddedEngine engine = EmbeddedEngine.create()
.using(config)
.notifying(this::handleEvent)
.build();
// Run the engine asynchronously ...
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(engine);
请注意,Oracle 数据库的配置如下所示。此外,从Oracle Instant Client获得的 ojdbc8.jar 和 xstreams.jar已导入到 java 项目中。
执行上述代码时,即使 Oracle 数据库关闭,它也会产生以下输出。也不会捕获更改。
28 [pool-1-thread-1] INFO org.apache.kafka.connect.storage.FileOffsetBackingStore - Starting FileOffsetBackingStore with file /home/username/oracleLogs/offset.dat
我在这里做错了什么?