# Unable to connect derbydb through jdbc

**URL:** <https://discuss.elastic.co/t/unable-to-connect-derbydb-through-jdbc/112751>\
**Category:** Logstash\
**Created:** [December 21, 2017, 5:45am UTC](https://discuss.elastic.co/t/unable-to-connect-derbydb-through-jdbc/112751 "2017-12-21T05:45:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![errupeshmca](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/errupeshmca/32/78285_2.png) [@errupeshmca](https://discuss.elastic.co/u/errupeshmca)\
**Post date:** [December 21, 2017, 5:45am UTC](https://discuss.elastic.co/t/unable-to-connect-derbydb-through-jdbc/112751/1 "2017-12-21T05:45:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [December 21, 2017, 12:15pm UTC](https://discuss.elastic.co/t/unable-to-connect-derbydb-through-jdbc/112751/2 "2017-12-21T12:15:47Z")

</div>

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

```auto
"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](http://www.codejava.net/java-se/jdbc/connect-to-apache-derby-java-db-via-jdbc#DerbyJdbcUrlNetworkClient)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 18, 2018, 12:15pm UTC](https://discuss.elastic.co/t/unable-to-connect-derbydb-through-jdbc/112751/3 "2018-01-18T12:15:48Z")

</div>

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