How to store longer json strings in tag history?


I have the gateway receiving SNMP traps (through Kymera’s SNMP driver) and initially I converted the trap message to a string and wrote it to a String tag. The tag stores it, but the historian refuses to take it, throwing errors that the string is too long. I tried splitting the trap into 2 parts, but it would still sometimes be too long and wouldn’t store in history…

java.lang.RuntimeException: java.sql.BatchUpdateException: String or binary data would be truncated in table '*********************************************', column 'stringvalue'. Truncated value: '{ Interface GigabitEthernet0/17, changed state to down,'.

(Table name has been removed from above log message)

I then tried changing the tag type to Document and storing the information as a json. The tag write is successful again, but now I get this error:

java.lang.RuntimeException: The conversion from UNKNOWN to VARCHAR is unsupported.

If neither a longer string or a json tag are able to store history, the only way I see to move forward is to either brake down the trap into even smaller bits and write to multiple tags, or to store the trap string and the timestamp myself with a named query…

Has anyone had similar problems with storing tag history? Is there some detail that i’m missing or something that I’ve misconfigured?

I appreciate any input.

The historian uses VARCHAR(255), or the equivalent of your flavor of SQL. You could try changing that, but its probably not a good idea, especially not if you have partitioning enabled. You could write your data to a table of your own design with scripting.

This thread has some good info that may help:
(Storing Datasets in MySQL Blobs)