# From several jdbs connection work only one

**URL:** <https://discuss.elastic.co/t/from-several-jdbs-connection-work-only-one/97097>\
**Category:** Logstash\
**Created:** [August 15, 2017, 12:44pm UTC](https://discuss.elastic.co/t/from-several-jdbs-connection-work-only-one/97097 "2017-08-15T12:44:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Limarev](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Michael\_Limarev](https://discuss.elastic.co/u/Michael_Limarev)\
**Post date:** [August 15, 2017, 12:44pm UTC](https://discuss.elastic.co/t/from-several-jdbs-connection-work-only-one/97097/1 "2017-08-15T12:44:06Z")

</div>

Hi.  
I try to make logstash (V 5.5) to read from 2 tables, and it actually does this at first.  
Logstash reads data from the first table, then from the second one.  
But then it begins to read only from one of them and I don't understand where is the problem.  
(Sory for this decor)

> input {  
> jdbc {  
> jdbc\_connection\_string =\> "jdbc:mysql://localhost:3306/ams"  
> # The user we wish to execute our statement as  
> jdbc\_user =\> ""  
> jdbc\_password =\> ""  
> # The path to our downloaded jdbc driver  
> jdbc\_driver\_library =\> "mysql-connector-java-5.1.42/mysql-connector-java-5.1.42-bin.jar"  
> # The name of the driver class for Postgresql  
> jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
> jdbc\_paging\_enabled =\> "true"  
> jdbc\_page\_size =\> "5000"  
> # our query  
> schedule =\> "\*/1 \* \* \* _"  
> statement =\> "  
> SELECT login\_info user  
> FROM login\_event  
> WHERE id \> :sql\_last\_value  
> "  
> use\_column\_value =\> true  
> tracking\_column =\> "id"  
> tracking\_column\_type =\> "numeric"  
> clean\_run =\> true  
> type =\> "loginEvent"  
> }  
> jdbc {  
> jdbc\_connection\_string =\> "jdbc:mysql://localhost:3306/ams"  
> # The user we wish to execute our statement as  
> jdbc\_user =\> ""  
> jdbc\_password =\> ""  
> # The path to our downloaded jdbc driver  
> jdbc\_driver\_library =\> "mysql-connector-java-5.1.42/mysql-connector-java-5.1.42-bin.jar"  
> # The name of the driver class for Postgresql  
> jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
> jdbc\_paging\_enabled =\> "true"  
> jdbc\_page\_size =\> "5000"  
> # our query  
> # schedule =\> "_/1 \* \* \* \*"  
> statement =\> "  
> SELECT start\_time, duration, id, created\_at, user  
> FROM content\_event  
> WHERE id \> :sql\_last\_value  
> "  
> use\_column\_value =\> true  
> tracking\_column =\> "id"  
> tracking\_column\_type =\> "numeric"  
> clean\_run =\> true  
> type =\> "contentEvent"  
> }  
> }  
> output {  
> stdout { codec =\> json\_lines }  
> elasticsearch {  
> "hosts" =\> "localhost:9200"  
> "index" =\> "ams"  
> "document\_type" =\> "%{type}"  
> "document\_id" =\> "%{id}"  
> }  
> }

---

<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:** [August 18, 2017, 5:25am UTC](https://discuss.elastic.co/t/from-several-jdbs-connection-work-only-one/97097/2 "2017-08-18T05:25:00Z")

</div>

With two jdbc inputs you should set `last_run_metadata_path` to unique values so that the state of one plugin doesn't overwrite the state of the other.

---

<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:** [September 15, 2017, 5:25am UTC](https://discuss.elastic.co/t/from-several-jdbs-connection-work-only-one/97097/3 "2017-09-15T05:25:12Z")

</div>

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