Help with JDBC source connector error for Postgres

I am a newbie to Kafka and having problems experimenting with a supposedly simple Postgres database source using Kafka connect. I keep getting the following error:

org.apache.kafka.connect.errors.ConnectException: java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5433/test

The code I used to create the connector is as follows:
echo ‘{“name”:“postgres-login-connector”,“config”:{“connector.class”:“io.confluent.connect.jdbc.JdbcSourceConnector”,“connection.url”:“jdbc:postgresql://localhost:5432/test”,“connection.user”:“postgres”,“connection.password”:“xxxxx”,“table.whitelist”:“login”,“timestamp.column.name”:“created_at”,“poll.interval.ms”:“2000”,“ssl.mode”:“prefer”,“mode”:“bulk”,“topic.prefix”:“postgres.”}}’ | sudo curl -X POST -d @- http://localhost:8083/connectors --header “content-Type:application/json”

I have checked several times and ensured that the plugin.path includes a folder with both the kafka-connect-jdbc-10.2.6.jar and postgresql-42.2.19.jar, and all the other jars that comes with the download from confluent website.

The test database and the login table I am trying to source from do exist, I can see the table from pgAdmin4 and can also insert more records through psql using the username and password that I am putting into the connector.

What am I getting wrong here?

@jmasvongo I wanted to share this detailed blog post from @rmoff which may contain tips that could help you debug this issue. In particular you could try increasing the connect worker logging level and look for plugin loading information, or, checking the jdbc URL once again for validity. Good luck, hope this helps

Thanks I managed to resolve the issue. I had copied into my plugin.path only the jar files I downloaded from Kafka instead of the whole folder. Putting the whole folder in there fixes the problem.

1 Like

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