Unable to connect derbydb through jdbc


(Heyan) #1

i need to extract data from tables which is DERBy db but i amd Facing issue with connecting derbydb through jdbc, Below is the configuration of mine.

elasticsearch version : 5.6.5
logstash version: 5.6.5

jdbc
{
jdbc_driver_library => "/usr/share/logstash/derby.jar"
jdbc_driver_class => "org.apache.derby.jdbc.EmbeddedDriver"
jdbc_connection_string => "jdbc:derby://localhost:1527/database/schema;create=true"
jdbc_user => "derbyuser"
jdbc_password => "derbypass"
statement => "select * from schema.table_name"
}

when i start logstash service with
$ initctl start logstash

getting below error in logs

Error: Sequel::DatabaseError: driver.new.connect returned nil: probably bad JDBC connection string
[2017-12-21T11:01:46,198][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Sequel::DatabaseError: driver.new.connect returned nil: probably bad JDBC connection string"}
[2017-12-21T11:01:46,200][ERROR][logstash.pipeline ] A plugin had an unrecoverable error. Will restart this plugin.

But when i run command
/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/test.conf

i am able to connect to derby and able to extract data from derbydb. But when i start logstash
service with initctl start logstash i am unable to connect with derby db,

please advice on this... why this is happening.

Thanks


(Guy Boertje) #2

You need to use the client jar and the client driver.

"jdbc_driver_class" => "org.apache.derby.jdbc.ClientDriver",
"jdbc_driver_library" =>"/<path_to>/derbyclient.jar",
"jdbc_connection_string" => "jdbc:derby://localhost/<some_db>;create=true" }

See http://www.codejava.net/java-se/jdbc/connect-to-apache-derby-java-db-via-jdbc#DerbyJdbcUrlNetworkClient


(system) #3

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