5
votes

I am trying to run an oracle source connector in Kafka using Oracle jdbc8 (ojdbc8.jar) in standalone mode. I have downloaded the confluent's jdbc jars and also the ojdbc8.jar from the Oracle website. I have tested this locally and it worked fine, but on our test environment, it is throwing the following error:

No suitable driver found for jdbc:oracle:thin:@x.x.x.x:yyyy:zzz for configuration Couldn't open connection to jdbc:oracle:thin:@x.x.x.x:yyyy:zzz

Full error message:

ERROR Failed to create job for xyz/xyz.properties (org.apache.kafka.connect.cli.ConnectStandalone:110)
[2020-03-11 13:13:32,085] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:121)
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:oracle:thin:@x.x.x.x:1521:xyz for configuration Couldn't open connection to jdbc:oracle:thin:@x.x.x.x:1521:xyz
Invalid value java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@x.x.x.x:1521:xyz for configuration Couldn't open connection to jdbc:oracle:thin:@x.x.x.x:1521:xyz

Plugins' path is also fine as it is registering all the jars. I have tried some fixes I found online which included putting the plugins path in the CLASSPATH variable. It didn't work, threw the same error as aforementioned. I am also able to ping and telnet the IP and Port respectively.

My connector configurations are as follows:

name=oracle-jdbc-connect
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
connection.url=jdbc:oracle:thin:@x.x.x.x:yyyy:zzz
connection.user=xyz
connection.password=xyz
query=SELECT cast(ID AS NUMBER(7, 0)) AS ID, NAME FROM sch.tbl
mode=incrementing
incrementing.column.name=ID
topic.prefix=topic-test
schema.pattern=sch
numeric.mapping=best_fit
dialect.name=OracleDatabaseDialect
timestamp.delay.interval.ms=5000
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=false
value.converter.schemas.enable=false
decimal.handling.mode=double
include.schema.changes=false

The connection.user given here has 'read-only' privileges in Oracle though. Can that be an issue here?

connect-standalone.properties file is as follows:

key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=true
value.converter.schemas.enable=true
offset.storage.file.filename=/tmp/connect.offsets
offset.flush.interval.ms=10000
rest.host.name=x.x.x.x
rest.port=8877 # Some random port
plugin.path=/home/plugins/,/usr/share/java,/usr/local/share/kafka/plugins

Oracle Version: 18c
Kafka Version: 2.3.0
Scala Version: 2.12.2

plugins.path: /home/plugins

Plugins Path Structure: /home/plugins/connectors/ [Folders like assets, docs, lib etc.], ojdbc8.jar.

Inside /home/plugins/connectors/lib, I have kafka-connect-jdbc-5.4.0.jar file.

2
Can you edit your question to include a complete folder listing of where you have your JDBC driver and Kafka Connect JDBC JARs?Robin Moffatt
@RobinMoffatt, edited at the end. Please, check! And yes, I have read that blogpost.Cyber Knight
Can you post the full error? What comes after Couldn't open connection to jdbc:oracle:thin:@x.x.x.x:yyyy:zzz ?Robin Moffatt
Does it work if you use this same setup against the Oracle DB that works in your local system? And visa versa - if you use your local system to connect to the Oracle DB in this test system?Robin Moffatt

2 Answers

1
votes

Your ojdbc8.jar needs to be in the same folder as the Kafka Connect JDBC JAR.

So if Kafka Connect JDBC JAR is in /home/plugins/connectors/lib then put ojdbc8.jar in there too.

1
votes

update to ojdbc10 if you are using java11. For kafka ojdbc8 is compatible with java8 and ojdbc10 with java11.