Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
JDBC connector
This connector should only be used if your data is simple and consists of primitive data types e.g., int. ClickHouse specific types such as maps aren’t supported.
License
The JDBC Connector is distributed under the Confluent Community LicenseSteps
Gather your connection details
To connect to ClickHouse with HTTP(S) you need this information:| Parameter(s) | Description |
|---|---|
HOST and PORT | Typically, the port is 8443 when using TLS or 8123 when not using TLS. |
DATABASE NAME | Out of the box, there is a database named default, use the name of the database that you want to connect to. |
USERNAME and PASSWORD | Out of the box, the username is default. Use the username appropriate for your use case. |
curl command.
If you’re using self-managed ClickHouse, the connection details are set by your ClickHouse administrator.
- Install Kafka Connect and Connector
We assume you have downloaded the Confluent package and installed it locally. Follow the installation instructions for installing the connector as documented here.
If you use the confluent-hub installation method, your local configuration files will be updated.
For sending data to ClickHouse from Kafka, we use the Sink component of the connector.
- Download and install the JDBC Driver
Download and install the ClickHouse JDBC driver clickhouse-jdbc-<version>-shaded.jar from here. Install this into Kafka Connect following the details here. Other drivers may work but haven’t been tested.
Common Issue: the docs suggest copying the jar to
share/java/kafka-connect-jdbc/. If you experience issues with Connect finding the driver, copy the driver to share/confluent-hub-components/confluentinc-kafka-connect-jdbc/lib/. Or modify plugin.path to include the driver - see below.
- Prepare configuration
Follow these instructions for setting up a Connect relevant to your installation type, noting the differences between a standalone and distributed cluster. If using Confluent Cloud the distributed setup is relevant.
The following parameters are relevant to using the JDBC connector with ClickHouse. A full parameter list can be found here:
_connection.url_- this should take the form ofjdbc:clickhouse://<clickhouse host>:<clickhouse http port>/<target database>connection.user- a user with write access to the target databasetable.name.format- ClickHouse table to insert data. This must exist.batch.size- The number of rows to send in a single batch. Ensure this set is to an appropriately large number. Per ClickHouse recommendations a value of 1000 should be considered a minimum.tasks.max- The JDBC Sink connector supports running one or more tasks. This can be used to increase performance. Along with batch size this represents your primary means of improving performance.value.converter.schemas.enable- Set to false if using a schema registry, true if you embed your schemas in the messages.value.converter- Set according to your datatype e.g. for JSON,io.confluent.connect.json.JsonSchemaConverter.key.converter- Set toorg.apache.kafka.connect.storage.StringConverter. We utilise String keys.pk.mode- Not relevant to ClickHouse. Set to none.auto.create- Not supported and must be false.auto.evolve- We recommend false for this setting although it may be supported in the future.insert.mode- Set to “insert”. Other modes aren’t currently supported.key.converter- Set according to the types of your keys.value.converter- Set based on the type of data on your topic. This data must have a supported schema - JSON, Avro or Protobuf formats.
value.converter.schemas.enable- Set to false as we utilize a schema registry. Set to true if you’re embedding the schema in each message.key.converter- Set to “org.apache.kafka.connect.storage.StringConverter”. We utilise String keys.value.converter- Set “io.confluent.connect.json.JsonSchemaConverter”.value.converter.schema.registry.url- Set to the schema server url along with the credentials for the schema server via the parametervalue.converter.schema.registry.basic.auth.user.info.