# Named query parameter's string limit

**URL:** <https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586>\
**Category:** Ignition\
**Created:** [December 9, 2024, 3:21pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586 "2024-12-09T15:21:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vrautomation](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vrautomation/32/11155_2.png) [@vrautomation](https://forum.inductiveautomation.com/u/vrautomation)\
**Post date:** [December 9, 2024, 3:21pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/1 "2024-12-09T15:21:12Z")

</div>

Hello everyone,

We use a named query to store data in a SQL Server table. We store a JSON containing multiple values in varchar(max) field.

At some point, the json is truncated. Since a varchar(max) have a limit of 2 GB, I know SQL Server is not the limiting factor.

Is there a limit at the named query level?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 9, 2024, 4:11pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/2 "2024-12-09T16:11:20Z")

</div>

There's no explicit limitations encoded anywhere in Ignition's codebase, but JSON is a notoriously inefficient format and there's a couple of different possible bottlenecks in the process, including but not limited to Java's maximum length for an array of `2,147,483,647` elements.

Where are you gathering/creating this JSON data, and how are you passing it in to the named query?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Hall](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jonathan\_Hall](https://forum.inductiveautomation.com/u/Jonathan_Hall)\
**Post date:** [December 9, 2024, 4:23pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/3 "2024-12-09T16:23:38Z")

</div>

when passing string parameter to the name query the string get truncated to 65535

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 9, 2024, 4:25pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/4 "2024-12-09T16:25:09Z")

</div>

Are you sure you are using the most appropriate JDBC driver version?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Hall](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jonathan\_Hall](https://forum.inductiveautomation.com/u/Jonathan_Hall)\
**Post date:** [December 9, 2024, 4:55pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/6 "2024-12-09T16:55:01Z")

</div>

in the Translators of the database driver setting

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/d/3d667aae30fc9eb4e30409c26f5b2a2025384797.png)

---

<div class="post-metadata">

**Author:** ![vrautomation](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vrautomation/32/11155_2.png) [@vrautomation](https://forum.inductiveautomation.com/u/vrautomation)\
**Post date:** [December 9, 2024, 5:31pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/7 "2024-12-09T17:31:18Z")

</div>

We get the data by reading a tag structure. We encode everything in a json and then we write that in the SQL table in a varchar(max) field.  
The issue here is not the json itself. It's the fact that the string is truncated to 65535 characters.  
We are trying to identify what is the limitation:

- The string in Ignition (awnser seems to be no)
- The named query string parameter (awnser seems to be no)
- The jbdc driver (?)
- The MS SQl Database (awnser = no)

---

<div class="post-metadata">

**Author:** ![vrautomation](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vrautomation/32/11155_2.png) [@vrautomation](https://forum.inductiveautomation.com/u/vrautomation)\
**Post date:** [December 9, 2024, 5:36pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/8 "2024-12-09T17:36:11Z")

</div>

> [@vrautomation](#):
>
> We use Ignition 8.1.42... Not sure of the JBDC version behind it...

We use Ignition 8.1.42... Not sure of the JBDC version behind it...

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 9, 2024, 6:31pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/9 "2024-12-09T18:31:22Z")

</div>

Definitely look into the JDBC driver.

I ran a quick non-scientific test; I was able to insert up to 100,000,000 character string into a SQLite DB (from the script console!); a 1 _billion_ character string failed to send with a clear OoM error that could probably be worked around.

```python
parameters = {
	"value": "a" * 100000000
}

system.db.runNamedQuery("nq", parameters)

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/c/3c106e73f665579ca1c0cd69ccb47ff06036cc7c.png)

---

<div class="post-metadata">

**Author:** ![vrautomation](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vrautomation/32/11155_2.png) [@vrautomation](https://forum.inductiveautomation.com/u/vrautomation)\
**Post date:** [December 9, 2024, 6:47pm UTC](https://forum.inductiveautomation.com/t/named-query-parameters-string-limit/99586/10 "2024-12-09T18:47:29Z")

</div>

Arrgh!!!

😓 😤

It was our mistake. A Select in SSMS do not show more than 65535 characters...

At least we learned how to upgrade the JBDC driver.

Very sorry and thanks for the help.
