2
votes

i have an issue about jdbc-sink with this arch.

postgres1 ---> kafka ---> postgres2

the producer working fine, but the consumer has an error :

connect_1 | org.apache.kafka.connect.errors.RetriableException: java.sql.SQLException: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO "customers" ("id") VALUES (1) ON CONFLICT ("id") DO UPDATE SET was aborted: ERROR: syntax error at end of input connect_1 |
Position: 77 Call getNextException to see other errors in the batch.

this is my source.json

{
"name": "src-table",
"config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "tasks.max": "1",
    "database.hostname": "postgres1_container",
    "database.port": "5432",
    "database.user": "postgres",
    "database.password": "postgres",
    "database.dbname": "postgres",
    "database.whitelist": "postgres",
    "database.server.name": "postgres1",
    "database.history.kafka.bootstrap.servers": "kafka:9092",
    "database.history.kafka.topic": "schema-changes.inventory",
    "transforms": "route",
    "transforms.route.type": "org.apache.kafka.connect.transforms.RegexRouter",
    "transforms.route.regex": "([^.]+)\\.([^.]+)\\.([^.]+)",
    "transforms.route.replacement": "$3"
}

and this my jdbc-sink.json

{
    "name": "jdbc-sink",
    "config": {
        "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
        "tasks.max": "1",
        "topics": "customers",
        "connection.url": "jdbc:postgresql://postgres2_container:5432/postgres?user=postgres&password=postgres",
        "transforms": "unwrap",
        "transforms.unwrap.type": "io.debezium.transforms.UnwrapFromEnvelope",
        "auto.create": "true",
        "insert.mode": "upsert",
        "pk.fields": "id",
        "pk.mode": "record_value"
    }
}

debezium/zookeeper : 0.9

debezium/kafka:0.9

debezium/postgres:9.6

debezium/connect:0.9

PostgreSQL JDBC Driver 42.2.5

Kafka Connect JDBC 5.2.1

i tried to downgrade jdbc driver and confluent kafka connect but still have the same error

1
I post a question similar to yours can you look ?stackoverflow.com/questions/68575974/… - Marcel kobain

1 Answers

0
votes

solve, the problem coz while i create a table in postgres1, i did not set the id to a PK value