我正在使用debeziumsqlserver跟踪生产基础上的更改。主题已经创建,cdc的工作非常出色,但是当尝试使用jdbcsinkconnector将数据转储到另一个sqlserverdb中时,我遇到了以下错误。 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",
"transforms.created_date.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
"transforms.created_date.target.type": "Timestamp",
"transforms.created_date.field": "created_date",
"transforms.modified_date.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
"transforms.modified_date.target.type": "Timestamp",
"transforms.modified_date.field": "modified_date",
"insert.mode": "insert",
"delete.enabled": "false",
"pk.fields": "id",
"pk.mode": "record_value",
"schema.registry.url": "http://localhost:8081",
"table.name.format": "ODS.swip.contract"
}
}
1条答案
按热度按时间7lrncoxx1#
sql server连接器dbz-1419中缺少功能。
您可以通过编写自己的smt来解决这个问题,该smt将在jdbc连接器处理字段之前在接收器端进行字段转换。