Kafka connect to sql server locally

1,511 views
Skip to first unread message

himani...@knoldus.in

unread,
Mar 16, 2017, 3:46:33 AM3/16/17
to Confluent Platform
Hi, I am trying to connect to my sql server database locally using kafka connect.

But this is the error that I am getting,

[2017-03-16 13:08:51,845] ERROR Couldn't open connection to jdbc:sqlserver://localhost:1433;database=test;password=H1man1Kn: java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433;database=test;password=H1man1Kn (io.confluent.connect.jdbc.JdbcSourceConnector:77)
[2017-03-16 13:08:51,845] ERROR Error while starting connector test-sqlite-jdbc-autoincrement (org.apache.kafka.connect.runtime.WorkerConnector:109)
org.apache.kafka.connect.errors.ConnectException: java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433;database=test;password=H1man1Kn
    at io.confluent.connect.jdbc.JdbcSourceConnector.start(JdbcSourceConnector.java:78)
    at org.apache.kafka.connect.runtime.WorkerConnector.doStart(WorkerConnector.java:101)
    at org.apache.kafka.connect.runtime.WorkerConnector.start(WorkerConnector.java:126)
    at org.apache.kafka.connect.runtime.WorkerConnector.transitionTo(WorkerConnector.java:183)
    at org.apache.kafka.connect.runtime.Worker.startConnector(Worker.java:178)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.startConnector(StandaloneHerder.java:250)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:164)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:94)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433;database=test;password=H1man1Kn
    at java.sql.DriverManager.getConnection(DriverManager.java:689)
    at java.sql.DriverManager.getConnection(DriverManager.java:270)
    at io.confluent.connect.jdbc.JdbcSourceConnector.start(JdbcSourceConnector.java:75)
    ... 7 more

Can you please tell where am I supposed to provide jdbc driver?

himani...@knoldus.in

unread,
Mar 16, 2017, 8:11:51 AM3/16/17
to Confluent Platform
I was able to fix the driver issue.

This is the updated log that I am getting,


 ERROR Error while starting connector test-sqlite-jdbc-autoincrement (org.apache.kafka.connect.runtime.WorkerConnector:109)
org.apache.kafka.connect.errors.ConnectException: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 0.0.0.0/test?user=himani&password=H1man1, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".

    at io.confluent.connect.jdbc.JdbcSourceConnector.start(JdbcSourceConnector.java:78)
    at org.apache.kafka.connect.runtime.WorkerConnector.doStart(WorkerConnector.java:101)
    at org.apache.kafka.connect.runtime.WorkerConnector.start(WorkerConnector.java:126)
    at org.apache.kafka.connect.runtime.WorkerConnector.transitionTo(WorkerConnector.java:183)
    at org.apache.kafka.connect.runtime.Worker.startConnector(Worker.java:178)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.startConnector(StandaloneHerder.java:250)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:164)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:94)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 0.0.0.0/test?user=himani&password=H1man1, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1033)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:817)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)

    at java.sql.DriverManager.getConnection(DriverManager.java:270)
    at io.confluent.connect.jdbc.JdbcSourceConnector.start(JdbcSourceConnector.java:75)
    ... 7 more



Gwen Shapira

unread,
Mar 21, 2017, 5:31:19 PM3/21/17
to confluent...@googlegroups.com
0.0.0.0 is probably not the right hostname. Maybe 127.0.0.1? or just "localhost"? 

--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
To post to this group, send email to confluent-platform@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/11a39421-ff21-40fc-9bce-2cd18dffad75%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Gwen Shapira
Product Manager | Confluent
650.450.2760 @gwenshap
Follow us: Twitter | blog

Vikas Soni

unread,
Jun 13, 2017, 5:59:23 PM6/13/17
to Confluent Platform
Hi Himani,

I am also facing the same No Driver Found issue. Are you using sqljdb4.jar and 1.7 JRE?

I am using Java 8 JRE and tried with both sqljdbc4.jar and sqljdb42.jar.

Appreciate your quick response.

Thanks,
Vikas

Vikas Soni

unread,
Jun 13, 2017, 7:10:32 PM6/13/17
to Confluent Platform
Hi ,

Problem resolved:

I have added sqljdbc4.jar in $CLASSPATH, but it didn't worked.
FYI, I am using Standalone version of Confluent.

When i copied the jar into the below location, my problem got resolved.

$HOME/confluent-3.2.1/share/java/kafka-connect-jdbc/

Not sure why the jar was not getting picked up from $CLASSPATH.

Thanks & Regards,
Vikas

kiran kumar BS

unread,
Mar 13, 2018, 2:31:36 PM3/13/18
to Confluent Platform
Hi,
I am getting No suitable driver found exception while connecting local mssql server via kafka connect.
stacktrace:

2018-03-13 23:49:53,772] ERROR Failed to create job for ../etc/kafka-connect-jdbc/source-mssql.properties (org.apache.kafka.connect.cli.ConnectStandalone:89)
[2018-03-13 23:49:53,774] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:100)
java.util.concurrent.ExecutionException: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector configuration is invalid and contains the following 2 error(s):
Invalid value java.sql.SQLException: No suitable driver found for jdbc:sqlserver//localhost:1433;databaseName=master;user=sa;password=Admin1234 for configuration Couldn't open connection to jdbc:sqlserver//localhost:1433;databaseName=master;user=sa;password=Admin1234

I have placed mssql-jdbc-6.2.2.jre8.jar at /confluent-3.3.0/share/java/kafka-connect-jdbc

Thanks,
Kiran.

kiran kumar BS

unread,
Mar 14, 2018, 5:51:34 AM3/14/18
to Confluent Platform
I found an issue.
There is a problem in my connection string. missed colon after jdbc:sqlserver

Vinod Ulava

unread,
Mar 6, 2019, 9:44:35 AM3/6/19
to Confluent Platform
Hi Kiran,

i am trying to connect SQL Server with Kafka.  Please help me..

Please give me steps..

Regards
Vinod

Robin Moffatt

unread,
Mar 7, 2019, 4:22:50 AM3/7/19
to confluent...@googlegroups.com
Hi Vinod, 

For connecting to SQL Server you have these options: 


To understand the difference between JDBC (query based CDC) and the other log-based CDC options, see https://www.confluent.io/blog/no-more-silos-how-to-integrate-your-databases-with-apache-kafka-and-cdc


-- 

Robin Moffatt | Developer Advocate | ro...@confluent.io | @rmoff



--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/8ffc009a-5bf2-43ae-b54e-e8b7524e90ee%40googlegroups.com.

Vinod Ulava

unread,
Mar 7, 2019, 10:35:53 AM3/7/19
to confluent...@googlegroups.com
Thank you so much Robin..

Reply all
Reply to author
Forward
0 new messages