sql-server - Apache Kafka 中的 IDENTITY_INSERT 问题 - JDBC - MSSQL
问题描述
使用 Apache Kafka 接收器连接器将数据从 SQL Server 插入/更新到 SQL Server 得到以下错误
java.sql.BatchUpdateException:当 IDENTITY_INSERT 设置为 OFF 时,无法在表“table_name”中插入标识列的显式值。在 com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:2075)
源配置
name=jdbc-mssql-prod-5
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
connection.url=jdbc:sqlserver:
connection.user=
connection.password=
topic.prefix= source_topic.
mode=timestamp
table.whitelist=A,B,C
timestamp.column.name=ModifiedDateTime
connection.backoff.ms=60000
connection.attempts=300
validate.non.null= false
# enter timestamp in milliseconds
timestamp.initial= -1
接收器配置
name=mysql-sink-prod-5
connector.class=io.confluent.connect.jdbc.JdbcSinkConnector
tasks.max=1
topics= sink_topic_a, sink_topic_b
connection.url=jdbc:sqlserver:
connection.user=
connection.password=
insert.mode=upsert
delete.enabled=true
pk.mode=record_key
errors.log.enable= true
errors.log.include.messages=true
在表中,主键列和标识列相同。
解决方案
推荐阅读
- python - ValueError:检查目标时出错:预期的 dense_22 具有 3 个维度,但得到的数组形状为 (1600, 2)
- lua - 如何使用 Lua 建立与“ttgo t call esp32 sim800L”的互联网连接
- android - 正常扫描二维码后,停止运行,无法显示扫描内容:
- python - 在 Python 中使用 pandas 库读取 .xlsx 文件时出错?
- json - 如何在 Github 上以 JSON 格式获取用户的项目列表
- authentication - 使用个人访问令牌对 GitHub 组织存储库进行 API 访问
- git - subgit 在 SVN 存储库中安装多个项目并更新更改
- python - Scandit python code 15 您的应用 ID 与许可证密钥的应用 ID 不匹配
- c# - 调整 autovacuum 以在数据库模式更改时运行?
- git - 吉特。恢复早于 HEAD 的提交失败