confluentinc / kafka-connect-jdbc

Kafka Connect connector for JDBC-compatible databases
Other
19 stars 956 forks source link

MySQL and MariaDB Connections Fail with Kafka Connect Date Error #865

Open rumline opened 4 years ago

rumline commented 4 years ago

Both the MySQL (mysql-connector-java-8.0.20.jar) and MariaDB (mariadb-java-client-2.6.0.jar) drivers fail with "Kafka Connect Date type should not have any time fields set to non-zero values".

The PostgreSQL (postgresql-42.2.10.jar) driver works just fine.

The error is being thrown by the upstream kafka-connect code: https://github.com/apache/kafka/blob/2.5.0/connect/api/src/main/java/org/apache/kafka/connect/data/Date.java Lines 60 - 64

Why are some drivers failing to generate a connection date and other work fine?

Configs attached: issue_865_mysql_jdbc_config.txt issue_865_mariadb_jdbc_config.txt

rumline commented 4 years ago

Same error when using the CDATA commercial JDBC drivers for MySQL and MariaDB.

aligh1979 commented 3 years ago

I am experiencing the same issues. having a 'Date' type filed in the table pupated with values like '2020-09-30' creates issues while source connector reads from the table. Kafka Connect Date type should not have any time fields set to non-zero values. I am using mariadb jdb connector and confluent platform 6.0.0. Update : Using the Mysql connector jar instead of MariaDb, fixed the issue. No error and all records are present in the kafka topic. So this issue is specific to mariaDB.