Named query parameter's string limit

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?

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?

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

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

in the Translators of the database driver setting

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)

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

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.

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

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

1 Like

Arrgh!!!

:sweat: :triumph:

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.

3 Likes