Senix
Senix

Reputation: 49

JDBC Sink Connector - how to specify a database schema in SQL Server?

I am using a JDBC Sink Connector to insert data into SQL Server. My table is called Plant and the schema is pts. So I'm trying to insert into InventoryManagement.pts.Plant.

I've set up a new user called testuserpts in SQL Server, with the default schema name set to pts. The error message that I'm getting back from Confluent is that Table "dbo"."Plant" is missing and auto-creation is disabled.

Here's my configuration for the sink connector. How do I prevent the sink from trying to connect to dbo.Plant?

  "value.converter.schema.registry.url": "http://schema-registry:8081",
  "value.converter.schemas.enable": "true",
  "name": "JdbcSinkConnector",
  "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
  "key.converter": "org.apache.kafka.connect.storage.StringConverter",
  "value.converter": "io.confluent.connect.avro.AvroConverter",
  "topics": ["plant"],
  "connection.url": "jdbc:sqlserver://host.docker.internal:53954;instance=SQLEXPRESS;databaseName=InventoryManagement",
  "connection.user": "testuserpts",
  "connection.password": "testpassword",
  "table.name.format": "Plant"

Upvotes: 1

Views: 2181

Answers (1)

Senix
Senix

Reputation: 49

I finally managed to get it working. The correct config is:

"table.name.format": "InventoryManagement.pts.Plant"

So, <db>.<schema>.<table

Upvotes: 2

Related Questions