Setting up connectors that use JDBC drivers
The Debezium and JDBC Kafka Connect connectors shipped with CSP Community Edition require a JDBC driver to function. However, by default only the PostgreSQL JDBC driver is available for use. If you want to deploy a connector that requires a different JDBC driver to function, you must copy the driver to the Kafka Connect container before you deploy the connector.
The following Kafka Connect connectors require a JDBC driver that does not come shipped with CSP Community Edition:
- Debezium Db2 Source
- Debezium MySQL Source
- Debezium Oracle Source
- Debezium SQL Server Source
- JDBC Source
- JDBC Sink
Before you can deploy any of these connectors you must copy the associated JDBC driver to the Kafka Connect Container. For the Debezium connectors, the location where you copy the driver JAR is fixed. Additionally, the Debezium connectors require that the JAR file is deployed within the container using a specific file name.
docker ps
. For
example:docker ps -a --format '{{.ID}}\t{{.Names}}' --filter "name=kafka-connect"
The Kafka Connect container will either be called cspce-kafka-connect-1
or
cspce_kafka-connect_1
.
- Debezium Db2 Source
-
- Download the Db2 JDBC driver.
The JDBC driver can be downloaded from Maven Central. Cloudera recommends that you use version 11.5.0.0.
- Navigate to the directory where the driver was extracted.
- Copy the driver to the Kafka Connect container and rename it.
docker cp ./jcc-[***VERSION***].jar [***KAFKA CONNECT CONTAINER NAME OR ID***]:/opt/connect/plugin/libs/debezium-connector-db2/db2-connector-java.jar
- Log in to the Kafka Connect container as the
root
user.docker exec -it --user root [***KAFKA CONNECT CONTAINER ID OR NAME***] /bin/bash
- Change the owner of the driver to the
kafka
user.chown kafka:cloudera /opt/connect/plugin/libs/debezium-connector-db2/db2-connector-java.jar
- Download the Db2 JDBC driver.
- Debezium MySQL Source
-
- Download the MySQL JDBC driver.
The JDBC driver can be downloaded from the MySQL Community Downloads page. Download the platform independent version. Cloudera recommends that you use version 8.0.27.
- Extract the files from the downloaded archive.You can use the
tar
command or any other archive manager to extract the archive. For example:tar -xf mysql-connector-java-[***VERSION***].tar.gz
- Navigate to the directory where the driver was
extracted.
cd mysql-connector-java-[***VERSION***]
- Copy the driver to the Kafka Connect container and rename
it.
docker cp ./mysql-connector-java-[***VERSION***].jar [***KAFKA CONNECT CONTAINER NAME OR ID***]:/opt/connect/plugin/libs/debezium-connector-mysql/mysql-connector-java.jar
- Log in to the Kafka Connect container as the
root
user.docker exec -it --user root [***KAFKA CONNECT CONTAINER ID OR NAME***] /bin/bash
-
Change the owner of the driver to the
kafka
user.chown kafka:cloudera /opt/connect/plugin/libs/debezium-connector-mysql/mysql-connector-java.jar
- Download the MySQL JDBC driver.
- Debezium Oracle Source
-
- Download the Oracle JDBC driver.
The JDBC driver can be downloaded from Maven Central. Cloudera recommends that you use version 12.2.0.1, 19.8.0.0, or 21.1.0.0.
- Navigate to the directory where the driver was downloaded.
- Copy the driver to the Kafka Connect container and rename
it.
docker cp ./ojdbc8-[***VERSION***].jar [***KAFKA CONNECT CONTAINER NAME OR ID***]:opt/connect/plugin/libs/debezium-connector-oracle/oracle-connector-java.jar
- Log in to the Kafka Connect container as the
root
user.docker exec -it --user root [***KAFKA CONNECT CONTAINER ID OR NAME***] /bin/bash
- Change the owner of the driver to the
kafka
user.chown kafka:cloudera /opt/connect/plugin/libs/debezium-connector-oracle/oracle-connector-java.jar
- Download the Oracle JDBC driver.
- Debezium SQL Server source
-
- Download the SQL Server JDBC driver.
The JDBC driver can be downloaded from the Microsoft JDBC Driver for SQL Server downloads page. Cloudera recommends that you use version 7.2.2.jre8. Download the zipped tar file, do not download the executable version.
- Extract the files from the downloaded archive.You can use the
tar
command or any other archive manager to extract the archive. For example:tar -xf sqljdbc_[***VERSION***]_enu.tar.gz
- Navigate to the directory where the driver was
extracted.
cd sqljdbc_[***VERSION***]/enu
- Copy the driver to the Kafka Connect container and rename it.
docker cp ./mssql-jdbc-[***VERSION***].jre8.jar [***KAFKA CONNECT CONTAINER NAME OR ID***]:/opt/connect/plugin/libs/debezium-connector-sqlserver/sqlserver-connector-java.jar
- Log in to the Kafka Connect container as the
root
user.docker exec -it --user root [***KAFKA CONNECT CONTAINER ID OR NAME***] /bin/bash
- Change the owner of the driver to the
kafka
user.chown kafka:cloudera /opt/connect/plugin/libs/debezium-connector-sqlserver/sqlserver-connector-java.jar
- Download the SQL Server JDBC driver.
- JDBC Source and Sink
-
- Download the driver.
The driver you need to download will depend on your use case and how you plan on using the JDBC Source or Sink connector. For example. if you want the connector to connect to a MySQL database, you need to download and deploy the MySQL JDBC driver.
- Extract the files from the downloaded archive. You can use the
tar
command or any other archive manager to extract the archive. For example:
Depending on the driver you downloaded, this step might not be required.tar -xf [***PATH TO JDBC DRIVER ARCHIVE***]
- Copy the driver to the Kafka connect container. For
example:
docker cp [***PATH TO JDBC DRIVER JAR***] [***KAFKA CONNECT CONTAINER NAME OR ID***]:/opt/connect/plugin/libs/
You can copy the driver to any location within the container. Cloudera recommends that you copy it to a directory that has no other JAR files. Additionally, ensure that you take note of the path as you must provide it in the connector's configuration during connector deployment.
- Change the owner of the driver to the
kafka
user.chown kafka:cloudera [***PATH TO DRIVER JAR***]
- Download the driver.