# Issue with jdbc for mariadb

**URL:** <https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255>\
**Category:** Logstash\
**Created:** [January 19, 2018, 2:37pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255 "2018-01-19T14:37:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolay\_Petrov](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nikolay\_Petrov](https://discuss.elastic.co/u/Nikolay_Petrov)\
**Post date:** [January 19, 2018, 2:37pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/1 "2018-01-19T14:37:49Z")

</div>

Hi,  
I'm honestly trying to browse for similar issue related to this topic, but not able to find any related..so, please excuse if my search engine is wrong, but most likely i will need a help with troubleshooting, why my configuration of extracting data from mariadb is not working so far:

logstash conf file:

> jdbc {  
> jdbc\_driver\_library =\> "/etc/logstash/jdbc-drivers/mariadb-java-client-2.2.1-sources.jar"  
> jdbc\_driver\_class =\> "org.mariadb.jdbc.Driver"  
> jdbc\_connection\_string =\> "jdbc:mariadb://overall:3306/tasks"  
> jdbc\_user =\> "..."  
> jdbc\_password =\> "..."  
> jdbc\_validate\_connection =\> true  
> jdbc\_page\_size =\> 50000  
> jdbc\_paging\_enabled =\> true  
> schedule =\> "\* \* \* \* \*"  
> statement =\> "SELECT \* from taskoverview"  
> sql\_log\_level =\> "debug"  
> type =\> "task-data"  
> }
> 
> output {  
> if [type] =~ "task-\*" {  
> elasticsearch {  
> hosts =\> "elastic:9200"  
> manage\_template =\> true  
> index =\> "task-data-%{+YYYY.MM.dd}"  
> document\_type =\> "%{[@metadata][type]}"  
> document\_id =\> "%{taskid}"  
> }  
> }

in logs:

> Error: org.mariadb.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc\_driver\_library?

What is wrong with configuration? What 'include' is meaning?  
:logstash-input-jdbc installed already  
java version "1.8.0\_151"

---

<div class="post-metadata">

**Author:** ![Nikolay\_Petrov](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nikolay\_Petrov](https://discuss.elastic.co/u/Nikolay_Petrov)\
**Post date:** [January 19, 2018, 4:07pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/2 "2018-01-19T16:07:04Z")

</div>

hm, after reading of mariadb connector doc [About MariaDB Connector/J - MariaDB Knowledge Base](https://mariadb.com/kb/en/library/about-mariadb-connector-j/)  
i was moving further, but still without success.  
Now i'm getting 'permission denied' for what?

> Plugin: \<LogStash::Inputs::Jdbc jdbc\_driver\_library=\>"/etc/logstash/jdbc-drivers/mariadb-java-client-2.2.1.jar", jdbc\_driver\_class=\>"org.mariadb.jdbc.Driver", jdbc\_connection\_string=\>"jdbc:mariadb://overall:3306/tasks", jdbc\_user=\>"...", jdbc\_password=\>, sql\_log\_level=\>"debug", statement=\>"SELECT \* from taskoverview", type=\>"task-data", id=\>"c8de2c09609c6c678d21dfab572c248a97e72669-9", enable\_metric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_11b4e6c1-530a-4969-8040-0adc0b6532e6", enable\_metric=\>true, charset=\>"UTF-8"\>, jdbc\_paging\_enabled=\>false, jdbc\_page\_size=\>100000, jdbc\_validate\_connection=\>false, jdbc\_validation\_timeout=\>3600, jdbc\_pool\_timeout=\>5, connection\_retry\_attempts=\>1, connection\_retry\_attempts\_wait\_time=\>0.5, parameters=\>{"sql\_last\_value"=\>2018-01-19 16:01:16 UTC}, last\_run\_metadata\_path=\>"/.logstash\_jdbc\_last\_run", use\_column\_value=\>false, tracking\_column\_type=\>"numeric", clean\_run=\>false, record\_last\_run=\>true, lowercase\_column\_names=\>true\>  
> Error: Permission denied - /.logstash\_jdbc\_last\_run

permission on db is set already

---

<div class="post-metadata">

**Author:** ![Nikolay\_Petrov](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nikolay\_Petrov](https://discuss.elastic.co/u/Nikolay_Petrov)\
**Post date:** [January 19, 2018, 4:49pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/3 "2018-01-19T16:49:59Z")

</div>

record\_last\_run =\> "true"  
was the reason of 'permission denied'...not related...now the log look ok

> [2018-01-19T16:43:00,590][INFO][logstash.inputs.jdbc] (0.075000s) SELECT \* FROM taskoverview

I'm completely blind on this...all ongoing issue on the start of this topic cleared already, but the data is still not ingested from maria -\> elasticsearch  
if you want and can, please help

---

<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:** [January 23, 2018, 10:12am UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/4 "2018-01-23T10:12:57Z")

</div>

Temporarily replace your elasticsearch output with a `stdout { codec => rubydebug }` output and run Logstash again. What happens?

---

<div class="post-metadata">

**Author:** ![Nikolay\_Petrov](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nikolay\_Petrov](https://discuss.elastic.co/u/Nikolay_Petrov)\
**Post date:** [January 23, 2018, 9:03pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/5 "2018-01-23T21:03:38Z")

</div>

The issue was coming from table field called as 'type', i suppose conflict with internal elastic already registered "\_type". We omit it for now to moving further and now the data is collected from 'mariadb', but another one issue is on place:  
when we grab the data via jdbc connector from database daily, the next day we have a duplicate entry from the previous grab....is there any way to prevent it, or make it works like incremental(just new item to be added)?

---

<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:** [January 23, 2018, 9:24pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/6 "2018-01-23T21:24:12Z")

</div>

Read the jdbc input docs and pay special attention to the `sql_last_value` parameter.

---

<div class="post-metadata">

**Author:** ![Nikolay\_Petrov](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nikolay\_Petrov](https://discuss.elastic.co/u/Nikolay_Petrov)\
**Post date:** [January 24, 2018, 8:00pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/7 "2018-01-24T20:00:07Z")

</div>

Yeah, double read it fix the issue))  
You are awesome again 😉  
Thanks a lot!

---

<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:** [February 21, 2018, 8:00pm UTC](https://discuss.elastic.co/t/issue-with-jdbc-for-mariadb/116255/8 "2018-02-21T20:00:33Z")

</div>

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