Below is my JDBC Sink Connector Configuration Properties.
"connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
"transforms.dropPrefix.replacement": "$1",
"table.name.format": "kafka_${topic}",
"connection.password": "********",
"tasks.max": "3",
"topics": "aiq.db1.Test1,aiq.db1.Test2,aiq.db2.Topic1,aiq.db2.Topic2",
"batch.size": "3000",
"transforms": "dropPrefix",
"transforms.dropPrefix.regex": "aiq.(.*)",
"transforms.dropPrefix.type": "org.apache.kafka.connect.transforms.RegexRouter",
"value.converter.schema.registry.url": "http://localhost:8081",
"value.converter.value.subject.name.strategy": "io.confluent.kafka.serializers.subject.RecordNameStrategy",
"auto.evolve": "true",
"connection.user": "admin",
"name": "MSSQL_jdbc_sink_connect",
"errors.tolerance": "all",
"auto.create": "true",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"connection.url": "jdbc:sqlserver://mssql",
"insert.mode": "upsert",
"key.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter.schema.registry.url": "http://localhost:8081",
"pk.mode": "record_value",
"pk.fields": "id"
If I used this then connector is looking for db1 or db2, which is source db and giving this error.
com.microsoft.sqlserver.jdbc.SQLServerException: Database 'db2' does not exist. Make sure that the name is entered correctly.
at io.confluent.connect.jdbc.sink.JdbcSinkTask.getAllMessagesException(JdbcSinkTask.java:150)
at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:102)
... 11 more
[2022-01-25 06:09:09,582] WARN Write of 500 records failed, remainingRetries=10 (io.confluent.connect.jdbc.sink.JdbcSinkTask:92)
com.microsoft.sqlserver.jdbc.SQLServerException: Database 'db2' does not exist. Make sure that the name is entered correctly.
Please let me know Can I create a JDBC sink connector which uses more than one databases for source topic. If this scenario is possible then How can I achieve this by using JDBC Sink Connector?
AFAIK, the connection.url
can only refer to one database at a time, for an authenticated user to that database.
If you need to write different topics to different databases, copy your connector config, and change the appropriate configs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.