# Facing Error while connecting Mariadb with elk through jdbc plugin

**URL:** <https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [May 19, 2020, 2:28pm UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341 "2020-05-19T14:28:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karthik\_Yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karthik_yadav/32/68640_2.png) [@Karthik\_Yadav](https://discuss.elastic.co/u/Karthik_Yadav)\
**Post date:** [May 19, 2020, 2:28pm UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341/1 "2020-05-19T14:28:52Z")

</div>

**Logstash configuration file**

input {  
jdbc {  
jdbc\_validate\_connection =\> true  
jdbc\_driver\_library =\> "/etc/java-libs/mariadb-java-client-2.4.2.jar"  
jdbc\_driver\_class =\> "Java::org.mariadb.jdbc.Driver"  
jdbc\_connection\_string =\> "jdbc:mariadb://192.168.43.86:3306/test\_database"  
jdbc\_user =\> "root"  
jdbc\_password =\> "mypass"  
schedule =\> "\*/1 \* \* \* \*"  
statement =\> "SELECT \* from logs"  
sql\_log\_level =\> "debug"  
record\_last\_run =\> true  
last\_run\_metadata\_path =\> "/etc/logstash/jdbc\_last\_run\_metadata\_path/mariadb"  
}  
}

output {  
elasticsearch {  
hosts =\> ["elasticsearch:9200"]  
index =\> "mariadb-%{+YYYY.MM}"  
}  
}

**Error**

Pipeline\_id:main  
Plugin: \<LogStash::Inputs::Jdbc jdbc\_user=\>"root", schedule=\>"\*/1 \* \* \* \*", last\_run\_metadata\_path=\>"/etc/logstash/jdbc\_last\_run\_metadata\_path/mariadb", jdbc\_validate\_connection=\>true, jdbc\_password=\>, statement=\>"SELECT \* from logs", jdbc\_driver\_library=\>"/etc/java-libs/mariadb-java-client-2.4.2.jar", jdbc\_connection\_string=\>"jdbc:mariadb://192.168.43.86:3306/test\_database", sql\_log\_level=\>"debug", id=\>"d87f5594d1055b9a122011e290769739601a307a1b549475fac60b43de8cc3a8", jdbc\_driver\_class=\>"Java::org.mariadb.jdbc.Driver", record\_last\_run=\>true, enable\_metric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_ac92da5f-7dca-43be-ade0-1c27c98fc3cc", enable\_metric=\>true, charset=\>"UTF-8"\>, jdbc\_paging\_enabled=\>false, jdbc\_page\_size=\>100000, jdbc\_validation\_timeout=\>3600, jdbc\_pool\_timeout=\>5, connection\_retry\_attempts=\>1, connection\_retry\_attempts\_wait\_time=\>0.5, plugin\_timezone=\>"utc", use\_column\_value=\>false, tracking\_column\_type=\>"numeric", clean\_run=\>false, lowercase\_column\_names=\>true, use\_prepared\_statements=\>false\>  
Error: unable to load /etc/java-libs/mariadb-java-client-2.4.2.jar from :jdbc\_driver\_library, file not readable (please check user and group permissions for the path)  
Exception: LogStash::PluginLoadingError  
Stack: /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.1/lib/logstash/plugin\_mixins/jdbc/jdbc.rb:172:in `block in load_driver_jars' org/jruby/RubyArray.java:1814:in `each'  
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.1/lib/logstash/plugin\_mixins/jdbc/jdbc.rb:167:in `load_driver_jars' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.1/lib/logstash/plugin_mixins/jdbc/jdbc.rb:148:in `load\_driver'  
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-integration-jdbc-5.0.1/lib/logstash/inputs/jdbc.rb:273:in `run' /usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:328:in `inputworker'  
/usr/share/logstash/logstash-core/lib/logstash/java\_pipeline.rb:320:in `block in start\_input'  
[2020-05-19T14:09:32,037][ERROR][logstash.javapipeline][main] A plugin had an unrecoverable error. Will restart this plugin.

Please help me with the proper solution

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 19, 2020, 3:32pm UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341/2 "2020-05-19T15:32:35Z")

</div>

> [@Karthik\_Yadav](#):
>
> Error: unable to load /etc/java-libs/mariadb-java-client-2.4.2.jar from :jdbc\_driver\_library, file not readable (please check user and group permissions for the path)

logstash is unable to read that file. As it says, check permissions on the file and each directory in the path (you will need at least x permission on each directory).

---

<div class="post-metadata">

**Author:** ![Karthik\_Yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karthik_yadav/32/68640_2.png) [@Karthik\_Yadav](https://discuss.elastic.co/u/Karthik_Yadav)\
**Post date:** [May 21, 2020, 8:02pm UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341/3 "2020-05-21T20:02:01Z")

</div>

Hi @Badger

I am facing the same issue after giving all permissions to each directory and file.

While checking with the curl --silent -XGET localhost:9200/\_cat/indices/mariadb\*?h=i,dc,  
It is showing the following error

{"error":{"root\_cause":[{"type":"security\_exception","reason":"missing authentication credentials for REST request [/\_cat/indices/mariadb\*?h=i,dc]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}}],"type":"security\_exception","reason":"missing authentication credentials for REST request [/\_cat/indices/mariadb\*?h=i,dc]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}},"status":401}

Can you please help with the proper solution @Badger

---

<div class="post-metadata">

**Author:** ![ptamba](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@ptamba](https://discuss.elastic.co/u/ptamba)\
**Post date:** [May 22, 2020, 12:21pm UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341/4 "2020-05-22T12:21:42Z")

</div>

> [@Karthik\_Yadav](#):
>
> {"error":{"root\_cause":[{"type":"security\_exception","reason":"missing authentication credentials for REST request [/\_cat/indices/mariadb\*?h=i,dc]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}}],"type":"security\_exception","reason":"missing authentication credentials for REST request [/\_cat/indices/mariadb\*?h=i,dc]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""}},"status":401}

this is authentication error. your es expect auth credentials

---

<div class="post-metadata">

**Author:** ![Karthik\_Yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karthik_yadav/32/68640_2.png) [@Karthik\_Yadav](https://discuss.elastic.co/u/Karthik_Yadav)\
**Post date:** [May 25, 2020, 7:33am UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341/5 "2020-05-25T07:33:19Z")

</div>

Hi Sir,  
I gave correct es credentials and gave full permission on each directory as mentioned in the above previous error, I am getting the same error

This is my logstash configuration file

 ![Screenshot from 2020-05-25 12-52-12](https://us1.discourse-cdn.com/elastic/original/3X/2/a/2a79daff61eda111e391cea68ab00646efb82c4b.png)

These are the logs from logstash

 ![Screenshot from 2020-05-25 12-51-42](https://us1.discourse-cdn.com/elastic/original/3X/2/8/283b45b671b3003c72ae27fad0584ef183db5efe.png)

Please help me with some commands and a proper solution.

---

<div class="post-metadata">

**Author:** ![ptamba](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@ptamba](https://discuss.elastic.co/u/ptamba)\
**Post date:** [May 25, 2020, 8:26am UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341/6 "2020-05-25T08:26:08Z")

</div>

please avoid using screenshot with error messages. best to copy paste them and wrap with \</\> icon.

your error messages says “unable to load the driver”. the user running logstash needs permission to access the jdbc library

---

<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:** [June 22, 2020, 8:28am UTC](https://discuss.elastic.co/t/facing-error-while-connecting-mariadb-with-elk-through-jdbc-plugin/233341/7 "2020-06-22T08:28:49Z")

</div>

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