# Logstash input jdbc not working

**URL:** <https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707>\
**Category:** Logstash\
**Created:** [October 12, 2017, 11:22am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707 "2017-10-12T11:22:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navinder](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@Navinder](https://discuss.elastic.co/u/Navinder)\
**Post date:** [October 12, 2017, 11:22am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707/1 "2017-10-12T11:22:27Z")

</div>

Hi, I am using logstash jdbc input, but it is throwing this error below.

The given configuration is invalid. Reason: Expected one of #, ", ', } at line 2, column 9 (byte 18) after input {  
jdbc { {:level=\>:fatal}

Here's my logstash config file.  
input {  
jdbc { jdbc\_driver\_class =\> "com.mysql.jdbc.Driver" jdbc\_connection\_string =\> "jdbc:mysql://myurl.com:3306/schema" jdbc\_user =\> "dsdsd" jdbc\_password =\> "hbad3" statement =\> "SELECT \* from xyztable" }  
}  
output {  
elasticsearch { index =\> "jet" hosts =\> ["[http://bdsdsd.com:9200](http://bdsdsd.com:9200)"] } }

I have downloaded mysql-connector-java-5.1.44 as well. Please look if you find any issue. Thanks

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 12, 2017, 11:38am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707/2 "2017-10-12T11:38:56Z")

</div>

If I copy/paste what you posted above I don't get that error so I suspect you have a garbage character in your config file.

---

<div class="post-metadata">

**Author:** ![Navinder](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@Navinder](https://discuss.elastic.co/u/Navinder)\
**Post date:** [October 13, 2017, 3:26am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707/3 "2017-10-13T03:26:03Z")

</div>

@magnusbaeck Can we do similar stuff for hive as well?

Also, I got above error solved, but now I am getting the error below

LogStash::ConfigurationError: com.mysql.jdbc.Driver not loaded. :jdbc\_driver\_library is not set, are you sure you included the proper driver client libraries in your classpath?\>

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 13, 2017, 5:25am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707/4 "2017-10-13T05:25:46Z")

</div>

> Can we do similar stuff for hive as well?

If it has a JDBC driver, sure. I don't think there's a Hive-specific plugin.

> LogStash::ConfigurationError: com.mysql.jdbc.Driver not loaded. :jdbc\_driver\_library is not set, are you sure you included the proper driver client libraries in your classpath?\>

As the example in the documentation indicates you should point that option at the location of the JDBC driver.

---

<div class="post-metadata">

**Author:** ![Navinder](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@Navinder](https://discuss.elastic.co/u/Navinder)\
**Post date:** [October 13, 2017, 5:35am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707/5 "2017-10-13T05:35:44Z")

</div>

Location of jdbc driver on the machine where logstash is installed or where we are trying to connect?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 13, 2017, 5:47am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707/6 "2017-10-13T05:47:37Z")

</div>

> Location of jdbc driver on the machine where logstash is installed

Yes.

> or where we are trying to connect?

Not sure what you mean.

---

<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:** [November 10, 2017, 5:47am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-not-working/103707/7 "2017-11-10T05:47:45Z")

</div>

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