# GatewayException: You have an error in your SQL syntax;

**URL:** <https://forum.inductiveautomation.com/t/gatewayexception-you-have-an-error-in-your-sql-syntax/97702>\
**Category:** Ignition\
**Created:** [October 24, 2024, 3:04am UTC](https://forum.inductiveautomation.com/t/gatewayexception-you-have-an-error-in-your-sql-syntax/97702 "2024-10-24T03:04:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Cobb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tom_cobb/32/68902_2.png) [@Tom\_Cobb](https://forum.inductiveautomation.com/u/Tom_Cobb)\
**Post date:** [October 24, 2024, 3:04am UTC](https://forum.inductiveautomation.com/t/gatewayexception-you-have-an-error-in-your-sql-syntax/97702/1 "2024-10-24T03:04:06Z")

</div>

I have a transaction group connecting to a MySQL database. It is getting messages about syntax errors in the SQL queries, but I can only see a snippet of the query. Enabling query logging in the MySQL database does not capture the attempted updates. I have searched for options to log the queries for my transaction group but I see none.

The database connection status on the gateway UI shows green and says "valid"

The ignition platform version is 7.6.7. The gateway is running on a Windows Server 2016.

When I run the query "SELECT \* from group\_table limit 1" in the Database Query Browser (group\_table exists), I get the error:

```python
GatewayException: 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 'FETCH FIRST 1000 ROWS ONLY' at line 1
	caused by SQLSyntaxErrorException: 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 'FETCH FIRST 1000 ROWS ONLY' at line 1

Ignition v7.6.7 (b2014082615)
Java: Oracle Corporation 1.8.0_331

```

I get this same error no matter what query I run.

I have tried downloading and re-installing the JDBC driver and re-creating the transaction group. I put the required config entries into the JDBC driver:

Connect URL:

`jdbc:mysql://<the lan ip>:3306/<the db name>`

and "Extra Connection Properties":

`zeroDateTimeBehavior=CONVERT_TO_NULL;connectTimeout=120000;socketTimeout=120000;useSSL=false;allowPublicKeyRetrieval=true;`

But nothing helps. Can anyone point me at something else to try?

---

<div class="post-metadata">

**Author:** ![flexware](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/flexware/32/66243_2.png) [@flexware](https://forum.inductiveautomation.com/u/flexware)\
**Post date:** [October 25, 2024, 4:03am UTC](https://forum.inductiveautomation.com/t/gatewayexception-you-have-an-error-in-your-sql-syntax/97702/2 "2024-10-25T04:03:59Z")

</div>

That is a strange error - it reminds me of a time I ran into something similar, and it ended up being an invalid Validation query in either my database connection or driver settings. I don't know if your issue has anything to do with this, but I'm just going to throw this out there in case it points you in the right direction.

First of all, I don't believe

```sql
FETCH FIRST 1000 ROWS ONLY

```

is valid MySQL syntax - that looks more like Oracle syntax. Here are the places in the gateway I would check - of course, you would need to look in the corresponding 7.6.7 versions of these configuration pages.

1. **Config-\>Databases-\>Drivers-\>MySQL-\>Edit**  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/823eae901b37c20f5fc9c64a2ca793cc0f1dbe24.png)
2. Same page, but switch tabs from "JDBC Drivers" to "Translators"  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/c/7c4f5cf70f38fde6a8f802d8427be1d95a64c3ff.png)
3. Go to your database Connection's settings, then expand Advanced Properties, then check this Validation Query field:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/aca22d2aacb94d7130228bfaf6b161ba94d29d88.png)

---

<div class="post-metadata">

**Author:** ![Tom\_Cobb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tom_cobb/32/68902_2.png) [@Tom\_Cobb](https://forum.inductiveautomation.com/u/Tom_Cobb)\
**Post date:** [October 25, 2024, 6:37pm UTC](https://forum.inductiveautomation.com/t/gatewayexception-you-have-an-error-in-your-sql-syntax/97702/3 "2024-10-25T18:37:19Z")

</div>

THANK YOU!!!! In checking all the areas you told me to check I noticed that under Advanced Properties, the Translator was set to "DB2" rather than 'MySQL'. Changed that and it started working.
