No suitable mariadb driver found

Hi there,

I've been trying to get logstash to connect to a mariadb instance without any luck. My config is pretty basic with:

input {
  jdbc {
    jdbc_connection_string => "jdbc:mariadb://192.168.40.202:3306/munkireport"
    jdbc_user => "munkireport"
    jdbc_password => "munkireport"
    jdbc_driver_library => "/opt/jdbc/mariadb-java-client-2.2.3.jar"
    jdbc_driver_class => "org.mariadb.jdbc.Driver"
    statement => "SELECT serial_number, hostname, os_version FROM `munkireport`.`machine`;"
    }
 }

And is returning the following error when trying to connect:

[2018-04-09T14:19:52,815][ERROR][logstash.pipeline        ] A plugin had an unrecoverable error. Will restart this plugin. Pipeline_id:main Plugin: <LogStash::Inputs::Jdbc jdbc_connection_string=>"jdbc:mariadb://192.168.40.202:3306/munkireport", jdbc_user=>"munkireport", jdbc_password=><password>, jdbc_driver_library=>"/opt/jdbc/mariadb-java-client-2.2.3.jar", jdbc_driver_class=>"org.mariadb.jdbc.Driver", statement=>"SELECT serial_number, hostname, os_version FROM `munkireport`.`machine`;", id=>"ede5f6baf9ecbff57b0f5af0185955f9dd528a8c3bd8be3bd7963b2e24e9fd9f", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_c3797e2f-3e5a-4806-9eed-a76c4772cf1b", enable_metric=>true, charset=>"UTF-8">, jdbc_paging_enabled=>false, jdbc_page_size=>100000, jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>{"sql_last_value"=>1969-12-31 18:00:00 -0600}, last_run_metadata_path=>"/usr/share/logstash/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true> Error: Java::JavaSql::SQLException: No suitable driver found for jdbc:mariadb://192.168.40.202:3306/munkireport  Exception: Sequel::DatabaseConnectionError  Stack: java.sql.DriverManager.getConnection(java/sql/DriverManager.java:689)

I've successfully tested the connection from another machine, so I know the permissions and access are correct for the connection to the database.

Is there anything else I can check or a sample config others have working connecting to a mariadb via the jdbc connection?

Looking at the code for the JDBC input plugin, I'm not seeing anything in particular; if the driver jar were missing, or if the specified driver class failed to load, we would have blown up in a more helpful manner. Additionally, the source of MariaDB's JDBC Driver indicates that it should report that it does support any url that starts with "jdbc:mariadb:", so once it is registered, Sequel should pick it up.

What versions of Logstash and JDBC input plugin are you using?

$LS_HOME/bin/logstash --version
$LS_HOME/bin/logstash-plugin list --verbose logstash-input-jdbc

The resolved version of sequel, which the logstash-input-jdbc plugin uses as a bridge, may also be helpful:

cat $LS_HOME/Gemfile.lock | grep sequel
1 Like

@yaauie - Thank you the reply back. I ran through all the versions and decided to see if the logstash-input-jdbc driver needed an update (after getting back 4.3.5) after updating the plugin to version 4.3.9 and re-loading, I was then able to use the input successfully!

Thank you so much for the assistance!

1 Like

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