Conversion to UNKNOWN in a query

Caused by: java.lang.Exception: Error executing system.db.runPrepUpdate(insert into aws_log(tagpath,lasttime) Values(?,?), [1_i1-1_i10/1_i10, 1517461200000], Ignition, , false, false)
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: SQL error for “insert into aws_log(tagpath,lasttime) Values(?,?)”: The conversion from UNKNOWN to UNKNOWN is unsupported.

Testing is this:
runPrepUpdate generates an error
runUpdateQuery runs fine, but the same parameters

OneRow = system.db.runPrepUpdate(“insert into aws_log(tagpath,lasttime) Values(?,?)”, [myTag,lastDate],databaseConnection)
sqlString = “insert into aws_log(tagpath,lasttime) Values(’” + myTag + “’,” + str(lastDate) + “)”
print sqlString
OneRow = system.db.runUpdateQuery(sqlString, databaseConnection)

This is a known issue with the JDBC driver for MS SQL shipped with Ignition. That driver can’t handle the conversion from python long datatype to SQL bigint.

One solution is to pass the parameter as a string str(...), or you can replace the JDBC driver with a newer version.

1 Like