MySQL 8: Could not create connection to database server

After upgrading to MySQL 8 I get the following error from my logstash pod:

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
[2021-07-30T09:31:38,885][ERROR][logstash.inputs.jdbc     ][main][f5be98a71736413fe373dedbd282a1ee25b169118a57eab4e43cc9337c337a2c] Unable to connect to database. Trying again {:error_message=>"Java::JavaSql::SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up."}

I upgraded to MySQL connector version 8.0.23 to match my MySQL version 8.0.23. Using logstash 7.8.1.

Relevant part of the config:

jdbc_driver_library => "/opt/bitnami/logstash/logstash-core/lib/jars/mysql-connector-java.jar"
    jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://mydb.database:3306/dbname?zeroDateTimeBehavior=convertToNull&useCursorFetch=true&autoReconnect=true&sessionVariables=group_concat_max_len=150000"

I tried it with jdbc_driver_library commented out too.

I'm not sure why I get the warning about the Java class name being wrong when jdbc_driver_class is already set to com.mysql.cj.jdbc.Driver

I got around this by bypassing the proxy sql server.

I'm now getting a different error:

[2021-07-30T11:56:30,283][WARN ][logstash.inputs.jdbc ][main][b59e523212418c01261b23483dd355d782cac58686142d9665b4d07fee6ae3d7] Exception when executing JDBC query {:exception=>"Java::JavaSql::SQLException: Incorrect DATE value: ''"}

which seems odd since I have the

zeroDateTimeBehavior=convertToNull

setting ??

Edit: that was just a problem in the query I was using

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