0
votes

I am using the JDBC Kafka Connector to read data from a database into Kafka. That works, but it always outputs data in Avro format even though I've specified that it should use JSON. I know it is doing this because when I consume messages from that topic in python, I see the schema at the top of each message.

I run the connector like this:

/usr/bin/connect-standalone /etc/schema-registry/connect-json-standalone.properties /etc/kafka-connect-jdbc/view.properties

The content of the connect-json-standalone.properties file is:

bootstrap.servers=localhost:9092

key.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schema.registry.url=http://localhost:8081
key.converter.schemas.enable=true
value.converter=org.apache.kafka.connect.json.JsonConverter
value.converter.schema.registry.url=http://localhost:8081
value.converter.schemas.enable=true

internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter.schemas.enable=false

# Local storage file for offset data
offset.storage.file.filename=/tmp/connect.offsets

and the content of the /etc/kafka-connect-jdbc/view.properties is:

name=view-small-jdbc-daily
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:teradata://domain.com/charset=UTF8,DBS_PORT=1025,DATABASE=test,USER=***,PASSWORD=***,LOB_SUPPORT=OFF
mode=bulk
table.whitelist=test_table
topic.prefix=view5-
1
Have you tried setting converter.schmas.enable=false?dawsaw

1 Answers

5
votes

Two problems in your configuration:

  1. If you are using JSONConverter, you don't need to configure a schema registry - this is just for the AvroConverter. So you can remove key.converter.schema.registry.url and value.converter.schema.registry.url
  2. Second, you have key.converter.schemas.enable=true and value.converter.schemas.enable=true, so you should not be surprised that the JSON includes a schema. You specified that we should include it. If you don't want a schema, just set those to false