我正在使用 debezium SQL Server 来跟踪生产基础上的变化。主题已创建,CDC 的工作非常出色,但是在尝试使用 jdbcSinkConnector 将数据转储到另一个 Sql Server DB 时,我遇到了以下错误。
com.microsoft.sqlserver.jdbc.SQLServerException: One or more values is out of range of values for the datetime2 SQL Server data type
在源数据库上,sql 数据类型是timestamp2(7)
. kafka 事件是 1549461754650000000。模式类型是 INT64。架构名称 io.debezium.time.NanoTimestamp。
我找不到一种方法来告诉 TimestampConverter 值不是以毫秒或微秒表示,而是以纳秒表示(无论如何都无法使用微秒)。
这是我的连接器配置
{
"name": "cdc.swip.bi.ods.sink.contract",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"tasks.max": "1",
"topics": "swip.swip_core.contract",
"connection.url": "jdbc:sqlserver://someip:1234;database=DB",
"connection.user": "loloolololo",
"connection.password": "muahahahahaha",
"dialect.name": "SqlServerDatabaseDialect",
"auto.create": "false",
"key.converter": "io.confluent.connect.avro.AvroConverter",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter.schemas.enable": "true",
"key.converter.schema.registry.url": "http://localhost:8081",
"value.converter.schemas.enable": "true",
"value.converter.schema.registry.url": "http://localhost:8081",
"transforms": "unwrap,created_date,modified_date",
"transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope", …
Run Code Online (Sandbox Code Playgroud)