# Jdbc: using statement\_filepath together with sql\_last\_value

**URL:** <https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748>\
**Category:** Logstash\
**Created:** [March 30, 2016, 2:29am UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748 "2016-03-30T02:29:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![titzi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/titzi/32/8760_2.png) [@titzi](https://discuss.elastic.co/u/titzi)\
**Post date:** [March 30, 2016, 2:29am UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748/1 "2016-03-30T02:29:28Z")

</div>

I want to use the jdbc plugin to sync data from MySQL to Elasticsearch. The MySQL query is quite long so I chose to put it in an external SQL file using the 'statement\_filepath' option in the Logstash config file.

Now I want to use the predefined parameter "sql\_last\_value" in this SQL file but this is throwing an error. I cannot find any documentation if this can be used together or if I have to put the whole SQL statement into the Logstash config file using the 'statement' option.

The SQL looks something like this:

```auto
...
WHERE updated_at > :sql_last_start
...

```

The error I get is:

```auto
Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComMysqlJdbcExceptionsJdbc4::MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':sql_last_start

```

Thankful for any feedback!

Alex

---

<div class="post-metadata">

**Author:** ![Herve\_SIMO](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@Herve\_SIMO](https://discuss.elastic.co/u/Herve_SIMO)\
**Post date:** [September 20, 2016, 11:14am UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748/2 "2016-09-20T11:14:50Z")

</div>

Hello Alex,

I have the same issue, do you already found a solution?

Thanks,  
Hervé

---

<div class="post-metadata">

**Author:** ![titzi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/titzi/32/8760_2.png) [@titzi](https://discuss.elastic.co/u/titzi)\
**Post date:** [September 20, 2016, 11:27am UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748/3 "2016-09-20T11:27:25Z")

</div>

Yes!

---

<div class="post-metadata">

**Author:** ![Herve\_SIMO](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@Herve\_SIMO](https://discuss.elastic.co/u/Herve_SIMO)\
**Post date:** [September 20, 2016, 11:43am UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748/4 "2016-09-20T11:43:53Z")

</div>

Can you share?

---

<div class="post-metadata">

**Author:** ![titzi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/titzi/32/8760_2.png) [@titzi](https://discuss.elastic.co/u/titzi)\
**Post date:** [September 20, 2016, 11:58am UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748/5 "2016-09-20T11:58:39Z")

</div>

Sure, sorry. It was my mistake. I used `sql_last_start` instead of `sql_last_value`.

---

<div class="post-metadata">

**Author:** ![Herve\_SIMO](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@Herve\_SIMO](https://discuss.elastic.co/u/Herve_SIMO)\
**Post date:** [September 20, 2016, 12:05pm UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748/6 "2016-09-20T12:05:34Z")

</div>

Ok, well received.

---

<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, 4:37am UTC](https://discuss.elastic.co/t/jdbc-using-statement-filepath-together-with-sql-last-value/45748/7 "2017-07-06T04:37:49Z")

</div>


