Phil Baines
Phil Baines

Reputation: 467

Unable to connect to SQLServer Kafka Connect

I have a docker image as located here https://github.com/Landoop/fast-data-dev which has all the good stuff that I am using for development. I've tried to add a JDBC connector to push into a Kafka topic however am getting this error. I've made a consumer in Java which is working fine however I would like to use KafkaConnect

Invalid value java.sql.SQLException: No suitable driver found for jdbc:sqlserver://servername for configuration Couldn't open connection to jdbc:sqlserver://servername

name=JdbcSourceConnector
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
connection.user=user
connection.password=password
tasks.max=1
connection.url=jdbc:sqlserver://servername
topic.prefix=test
table.whitelist=dbo.IB_WEBLOG_DUMMY_small
query=SELECT * FROM IB_WEBLOG_DUMMY_small
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter=org.apache.kafka.connect.json.JsonConverter
poll.interval.ms=5000
table.poll.interval.ms=120000
mode=bulk

What should I be looking into to fix this problem?

Upvotes: 1

Views: 1217

Answers (1)

Behrang Saeedzadeh
Behrang Saeedzadeh

Reputation: 47933

Your JDBC driver’s JAR file is not in Kafka Connect’s classpath. Put it there and you will be good to go:

One option is to install the JDBC driver jar alongside the connector. The packaged connector is installed in the share/java/kafka-connect-jdbc directory, relative to the installation directory. If you have installed from Debian or RPM packages, the connector will be installed in /usr/share/java/kafka-connect-jdbc. If you installed from zip or tar files, the connector will be installed in the path given above under the directory where you unzipped the Confluent Platform archive.

Alternatively, you can set the CLASSPATH variable before running connect-standalone or connect-distributed. For example:

$ CLASSPATH=/usr/local/firebird/* ./bin/connect-distributed ./config/connect-distributed.properties

Alternatively, put all the SQL Server JDBC JAR files in the libs dir under the root folder of Apache Kafka. But that would pollute the classpath and is better to be avoided in production.

Upvotes: 1

Related Questions