# JDBC plugin reloads everything, everytime

**URL:** <https://discuss.elastic.co/t/jdbc-plugin-reloads-everything-everytime/117254>\
**Category:** Logstash\
**Created:** [January 26, 2018, 7:07pm UTC](https://discuss.elastic.co/t/jdbc-plugin-reloads-everything-everytime/117254 "2018-01-26T19:07:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheEvilDonut](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TheEvilDonut](https://discuss.elastic.co/u/TheEvilDonut)\
**Post date:** [January 26, 2018, 7:07pm UTC](https://discuss.elastic.co/t/jdbc-plugin-reloads-everything-everytime/117254/1 "2018-01-26T19:07:23Z")

</div>

Hello All.

I am trying to get data from a SQL Server BD with a very simple query. For some reason everytime I restart Logstash the whole data gets loaded into Elasticsearch.

The marker file seems OK, the very last ID is contained within the file but I don't get why everything gets extracted each time.

Anyone seeing something not right with my input configuration?

Thanks!

input {

jdbc {  
jdbc\_driver\_library =\> "C:\logstash\drivers\mssql-jdbc-6.2.2.jre7.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
jdbc\_connection\_string =\> "jdbc:sqlserver://9.9.9.9:52824;instanceName=MyInstance;databasename=MyBD"  
jdbc\_user =\> "logstash"  
jdbc\_password =\> "SomePassword"  
record\_last\_run =\> true  
use\_column\_value =\> true  
last\_run\_metadata\_path =\> "C:\logstash\SQL\marker.txt"  
statement =\> "SELECT evt.event\_id, Field1, Field2, Field3 FROM MyTable evt ORDER BY evt.event\_id"  
tracking\_column\_type =\> "numeric"  
tracking\_column =\> "event\_id"  
tags =\> "KAS"  
}  
}

---

<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 29, 2018, 7:21am UTC](https://discuss.elastic.co/t/jdbc-plugin-reloads-everything-everytime/117254/2 "2018-01-29T07:21:12Z")

</div>

Your query always fetches all rows; it doesn't reference the `sql_last_value` parameter to restrict the selection of rows to only those it haven't processed before.

---

<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 26, 2018, 7:21am UTC](https://discuss.elastic.co/t/jdbc-plugin-reloads-everything-everytime/117254/3 "2018-02-26T07:21:15Z")

</div>

Closed on February 26, 2018, 7:21am UTC

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