# SQLSyntaxErrorException

**URL:** <https://discuss.elastic.co/t/sqlsyntaxerrorexception/102967>\
**Category:** Logstash\
**Created:** [October 6, 2017, 8:13am UTC](https://discuss.elastic.co/t/sqlsyntaxerrorexception/102967 "2017-10-06T08:13:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harald\_Hodl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harald_hodl/32/22832_2.png) [@Harald\_Hodl](https://discuss.elastic.co/u/Harald_Hodl)\
**Post date:** [October 6, 2017, 8:13am UTC](https://discuss.elastic.co/t/sqlsyntaxerrorexception/102967/1 "2017-10-06T08:13:22Z")

</div>

Hi,

im facing an issue while running logstash in combination with mariadb.  
I have already figured out that the statement without quotation marks is working.

> logstash 5.6.2

Now my Question how can i remove the "", marked bold in the log file ?

console:

> MariaDB [(none)]\> SELECT count(\*) AS COUNT FROM (SELECT \* FROM gsc.shecz where shecz\_id \> 0) AS T1 LIMIT 1  
> -\> ;  
> +--------+  
> | COUNT |  
> +--------+  
> | 480290 |  
> +--------+  
> 1 row in set (0.20 sec)
> 
> MariaDB [(none)]\>

My Config:

> input {  
> jdbc {  
> jdbc\_driver\_library =\> "/usr/data/mariadb-java-client-2.1.2.jar"  
> jdbc\_driver\_class =\> "org.mariadb.jdbc.Driver"  
> jdbc\_connection\_string =\> "jdbc:mariadb://10.192.242.173:3306/gsc"  
> jdbc\_user =\> "_**"  
> jdbc\_password =\> "**_"  
> schedule =\> "\* \* \* \* \*"  
> statement =\> "SELECT \* FROM gsc.shecz where shecz\_id \> :sql\_last\_value"  
> use\_column\_value =\> true  
> tracking\_column =\> "shecz\_id"  
> tracking\_column\_type =\> "numeric"  
> clean\_run =\> true  
> last\_run\_metadata\_path =\> "/etc/logstash/conf.d/.logstash\_jdbc\_last\_run"
> 
> jdbc\_paging\_enabled =\> "true"  
> jdbc\_page\_size =\> "100000"
> 
> }  
> }  
> output {  
> elasticsearch {  
> hosts =\> ["10.192.242.173:9200"]  
> index =\> "gsc.shecz"   
> }  
> }

Error:

> [2017-10-06T10:07:00,085][ERROR][logstash.inputs.jdbc] Java::JavaSql::SQLSyntaxErrorException: (conn=235) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near **'"T1"** LIMIT 1' at line 1: SELECT count(\*) AS **"COUNT"** FROM (SELECT \* FROM gsc.shecz where shecz\_id \> 0) AS **"T1"** LIMIT 1  
> [2017-10-06T10:07:00,087][WARN][logstash.inputs.jdbc] Exception when executing JDBC query {:exception=\>#\<Sequel::DatabaseError: Java::JavaSql::SQLSyntaxErrorException: (conn=235) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"T1" LIMIT 1' at line 1\>}

Thanks in Advance  
Harald

---

<div class="post-metadata">

**Author:** ![Harald\_Hodl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harald_hodl/32/22832_2.png) [@Harald\_Hodl](https://discuss.elastic.co/u/Harald_Hodl)\
**Post date:** [October 6, 2017, 9:11am UTC](https://discuss.elastic.co/t/sqlsyntaxerrorexception/102967/2 "2017-10-06T09:11:46Z")

</div>

The Answer is:  
SET GLOBAL sql\_mode = 'ANSI\_QUOTES';

---

<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:** [November 3, 2017, 9:12am UTC](https://discuss.elastic.co/t/sqlsyntaxerrorexception/102967/3 "2017-11-03T09:12:05Z")

</div>

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