# Include session variables in the connection string for jdbc\_static fails

**URL:** <https://discuss.elastic.co/t/include-session-variables-in-the-connection-string-for-jdbc-static-fails/319631>\
**Category:** Logstash\
**Tags:** jdbc\
**Created:** [November 23, 2022, 8:58am UTC](https://discuss.elastic.co/t/include-session-variables-in-the-connection-string-for-jdbc-static-fails/319631 "2022-11-23T08:58:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muecker](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@Muecker](https://discuss.elastic.co/u/Muecker)\
**Post date:** [November 23, 2022, 8:58am UTC](https://discuss.elastic.co/t/include-session-variables-in-the-connection-string-for-jdbc-static-fails/319631/1 "2022-11-23T08:58:41Z")

</div>

Hello, i want to use the jdbc\_static plugin from logstash, but it throws an error:

```auto
[2022-11-22T13:36:19,153][WARN][org.mariadb.jdbc.message.server.ErrorPacket][pipeline_name] Error: 1064-42000: 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 ';) AS "T1" LIMIT 1' at line 1

```

So, this error is well known. The plugin tries to count the result set and send a query with quotes to the database server. The database server isn't configured with "SET GLOBAL sql\_mode = 'ansi\_quotes'" and i'm not able to change this. I've read, that you can modify the jdbc connection string as workaround, like this:

```auto
jdbc_connection_string => "jdbc:mariadb://dbhost:3306/db?sessionVariables=sql_mode=ANSI_QUOTES"

```

But this will not work at my site. The error is the same as above. If i connect directly to the db server and set the ansi\_quotes in the actual session, i can fire up the query including quotes without problems. So, what i'm doing wrong? I'm using the jdbc driver lib mariadb-java-client-3.1.0.jar (latest).

cheers,  
Muecker

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 23, 2022, 4:24pm UTC](https://discuss.elastic.co/t/include-session-variables-in-the-connection-string-for-jdbc-static-fails/319631/2 "2022-11-23T16:24:05Z")

</div>

This is an [open issue](https://github.com/logstash-plugins/logstash-filter-jdbc_static/issues/62). See also the issue that links to.

---

<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:** [December 21, 2022, 4:24pm UTC](https://discuss.elastic.co/t/include-session-variables-in-the-connection-string-for-jdbc-static-fails/319631/3 "2022-12-21T16:24:10Z")

</div>

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