No suitable driver found for jdbc


#1

Hi,

Hope someone can help.

I have the following jar files in a directory named /etc/logstash/jars/

-rw-r--r-- 1 logstash logstash 987191 Jan 9 15:08 mysql-connector-java-5.1.38.jar
-rw-r--r-- 1 logstash logstash 987191 Jan 6 14:47 mysql.jar

I have the following in my logstash.conf file (critical values have been replaced for this post) ;

jdbc {
jdbc_driver_library => "/etc/logstash/jars/mysql-connector-java-5.1.38.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:IP Address:3306/dbName"
jdbc_user => "UserName
jdbc_password => "password"
schedule => "* * * * *" # every minute
statement => "select * from Table"
type => "Type"
}

and yet I'm getting this error -

[2017-01-09T15:19:15,065][ERROR][logstash.agent ] Pipeline aborted due to error {:exception=>#<Sequel::DatabaseConnectionError: Java::JavaSql::SQLException: No suitable driver found for jdbc:xxxx. . .

What am I missing? The jar file is where it's supposed to be and the config file is looking in the place.

Any help is much appreciated.


(Tal Levy) #2

just to be sure you are using the right driver.

when I fetched the driver from: https://downloads.mysql.com/archives/get/file/mysql-connector-java-5.1.38.zip, I saw that the driver file was 983914 bytes. Probably not related.

Another thing I see is that you do not list the type in the connection string. mysql's connection string has a mysql in it.

e.g. jdbc:mysql://localhost:3306/testdb

is that what you tried?


#3

Thanks Tal.

I've added the 'mysql' to the string and the error has been fixed.

Thanks again.


(system) #4

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