# Logstash mysql using jdbc on windows: library error

**URL:** <https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313>\
**Category:** Logstash\
**Created:** [December 16, 2015, 7:01am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313 "2015-12-16T07:01:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 16, 2015, 7:01am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/1 "2015-12-16T07:01:17Z")

</div>

## I want to insert data from mysql to elasticsearch using logstash.

when I am running command, logstash -f myconf.conf  
I am getting following error:

D:\Users\admin\setups\logstash-2.1.1\bin\>logstash -f myconf.conf

io/console not supported; tty will not be manipulated  
Settings: Default filter workers: 2  
Error: com.jdbc.mysql.Driver not loaded. Are you sure you've included the correc  
t jdbc driver in :jdbc\_driver\_library?  
You may be interested in the '--configtest' flag which you can  
use to validate logstash's configuration before you choose  
to restart a running system.

**I am using following conf settings...**

```
 input {
jdbc {
jdbc_driver_library => "D:/mysql-connector-java-5.1.37-bin.jar"
jdbc_driver_class => "com.jdbc.mysql.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/testdatabase"
jdbc_user => "root"
jdbc_password => "root"
schedule => "5"
statement => "SELECT * from testtable"
}
}

output {
elasticsearch {
hosts => "localhost"
action => "index"
index => "testindex"
}
stdout { codec => rubydebug }
}

```

**My java version is**

java version "1.7.0\_79"  
Java(TM) SE Runtime Environment (build 1.7.0\_79-b15)  
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

**I am using MySQL Server version: 5.7.9**

**And I've placed my jar in d: [d-drive]**

I've spent enough time on this, and referred google for this, but didn't get solution.  
Is there any PATH setting is required for loading library?  
**Suggest necessary solution.**

---

<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:** [December 16, 2015, 7:02am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/2 "2015-12-16T07:02:47Z")

</div>

What's in myconf.conf?

---

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 16, 2015, 7:04am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/3 "2015-12-16T07:04:05Z")

</div>

Hi magnusbaeck,  
Please see the post again, I've edited for myconf.conf

---

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 16, 2015, 7:27am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/4 "2015-12-16T07:27:48Z")

</div>

Error message I am receiving here is,

**Error: com.jdbc.mysql.Driver not loaded. Are you sure you've included the correc**  
**t jdbc driver in :jdbc\_driver\_library?**

---

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 16, 2015, 7:50am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/5 "2015-12-16T07:50:16Z")

</div>

**FYI, I am using Logstash 2.1.1**

---

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 16, 2015, 7:52am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/6 "2015-12-16T07:52:04Z")

</div>

## myconf.conf contains

```
input {
jdbc {
jdbc_driver_library => "D:/mysql-connector-java-5.1.37-bin.jar"
jdbc_driver_class => "com.jdbc.mysql.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/testdatabase"
jdbc_user => "root"
jdbc_password => "root"
schedule => "5"
statement => "SELECT * from testtable"
}
}

output {
elasticsearch {
hosts => "localhost"
action => "index"
index => "testindex"
}
stdout { codec => rubydebug }
}
```

---

<div class="post-metadata">

**Author:** ![razafinr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/razafinr/32/45334_2.png) [@razafinr](https://discuss.elastic.co/u/razafinr)\
**Post date:** [December 16, 2015, 9:36am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/7 "2015-12-16T09:36:44Z")

</div>

For your jdbc\_driver\_class try Java::com.jdbc.mysql.Driver

---

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 16, 2015, 12:15pm UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/8 "2015-12-16T12:15:16Z")

</div>

Thanks @razafinr

But did not work.

---

<div class="post-metadata">

**Author:** ![CraigFoote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craigfoote/32/4571_2.png) [@CraigFoote](https://discuss.elastic.co/u/CraigFoote)\
**Post date:** [December 16, 2015, 4:04pm UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/9 "2015-12-16T16:04:39Z")

</div>

The driver class should be com.mysql.jdbc.Driver.

---

<div class="post-metadata">

**Author:** ![krushnat\_khawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krushnat_khawale/32/6652_2.png) [@krushnat\_khawale](https://discuss.elastic.co/u/krushnat_khawale)\
**Post date:** [December 17, 2015, 8:45am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/10 "2015-12-17T08:45:46Z")

</div>

What a silly mistake. I need to be more careful about spellings.

THANKS @CraigFoote🎄

---

<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:** [July 6, 2017, 5:18am UTC](https://discuss.elastic.co/t/logstash-mysql-using-jdbc-on-windows-library-error/37313/11 "2017-07-06T05:18:06Z")

</div>


