# The JDBC Sink Connector and Schemas

**URL:** <https://forum.confluent.io/t/the-jdbc-sink-connector-and-schemas/2274>\
**Category:** Kafka Connect\
**Created:** [16 July 2021 09:28 UTC](https://forum.confluent.io/t/the-jdbc-sink-connector-and-schemas/2274 "2021-07-16T09:28:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmoff](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/rmoff/32/3_2.png) [@rmoff](https://forum.confluent.io/u/rmoff)\
**Post date:** [16 July 2021 09:28 UTC](https://forum.confluent.io/t/the-jdbc-sink-connector-and-schemas/2274/1 "2021-07-16T09:28:20Z")

</div>

The [JDBC Sink connector](https://www.confluent.io/hub/confluentinc/kafka-connect-jdbc) streams data from Kafka to a relational database and relational databases have schemas 😃 The JDBC Sink connector therefore _requires_ a schema to be present for the data.

The kind of errors that you can see as a side-effect of not providing a schema with your data include:

> `org.apache.kafka.connect.errors.ConnectException: Sink connector 'my-db-sink' is configured with 'delete.enabled=false' and 'pk.mode=none' and therefore requires records with a non-null Struct value and non-null Struct schema, but found record at (topic='nevergonnagiveyouup',partition=0,offset=0,timestamp=1626416123456) with a HashMap value and null value schema.`

Depending on where your data is coming from you have different options.

- **If it’s ingested from Kafka Connect** , use a converter that supports schemas (Avro, Protobuf, JSON Schema)
- **If it’s produced by an application that you have control over** , get that application to serialise that data with a schema (Avro, Protobuf, JSON Schema)
- **If it’s coming from somewhere you don’t have control over** then you’ll need to pre-process the topic to add an explicit schema and write it to a new topic that is then consumed by the JDBC Sink connector.

References & resources:

- [Kafka Connect JDBC Sink deep-dive: Working with Primary Keys](https://rmoff.net/2021/03/12/kafka-connect-jdbc-sink-deep-dive-working-with-primary-keys/)
- [Applying a schema to JSON data with ksqlDB](https://www.youtube.com/watch?v=b-3qN_tlYR4&t=1683s)
- [JDBC Sink connector docs](https://docs.confluent.io/kafka-connect-jdbc/current/sink-connector/index.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [15 August 2021 09:28 UTC](https://forum.confluent.io/t/the-jdbc-sink-connector-and-schemas/2274/2 "2021-08-15T09:28:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
