Error in query why? no error

I’m doing this query in a gateway script and it gives this error, but no error in query?
table = system.db.runQuery("Select t_stamp, K909,K910,K911,K912,K861,DE1,DE2,DE3,DE4 FROM [SERVIDORDERECETAS].[dbo].[BisagrasPorton] where K861 = ‘PORT-BFW’ and t_stamp between ‘2018-12-5 06:00:00’ and ‘2018-12-6 05:59:59’ ")

[ERROR] 8:17:01 AM Scripting.TagChangeScriptManager Error executing tag change script: MedicionBisagrasVS20/6AMBFW

Traceback (innermost last):
File “TagChangeScript:MedicionBisagrasVS20/6AMBFW”, line 1, in ?
File “module:ExportacionDatos”, line 17, in Exportacion
java.lang.Exception: Error executing system.db.runQuery(Select t_stamp, K909,K910,K911,K912,K861,DE1,DE2,DE3,DE4 FROM [SERVIDORDERECETAS].[dbo].[BisagrasPorton] where K861 = ‘PORT-BFW’ and t_stamp between ‘2018-12-5 06:00:00’ and ‘2018-12-6 05:59:59’, , )

at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:293)

at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runQuery(AbstractDBUtilities.java:265)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)

at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:313)

at org.python.core.PyObject.__call__(PyObject.java)

at org.python.core.PyObject.invoke(PyObject.java)

at org.python.pycode._pyx51.Exportacion$1(<module:ExportacionDatos>:17)

at org.python.pycode._pyx51.call_function(<module:ExportacionDatos>)

at org.python.core.PyTableCode.call(PyTableCode.java)

at org.python.core.PyTableCode.call(PyTableCode.java)

at org.python.core.PyFunction.__call__(PyFunction.java)

at org.python.core.PyObject.__call__(PyObject.java)

at org.python.core.PyObject.invoke(PyObject.java)

at org.python.pycode._pyx50.f$0(<TagChangeScript:MedicionBisagrasVS20/6AMBFW>:1)

at org.python.pycode._pyx50.call_function(<TagChangeScript:MedicionBisagrasVS20/6AMBFW>)

at org.python.core.PyTableCode.call(PyTableCode.java)

at org.python.core.PyCode.call(PyCode.java)

at org.python.core.Py.runCode(Py.java)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:394)

at com.inductiveautomation.ignition.common.script.TagChangeScriptManager$TagChangeScriptHandler$Runner.run(TagChangeScriptManager.java:170)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.sql.SQLException: java.lang.IllegalArgumentException: Unknown typecode: -15

at com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset.<init>(BasicStreamingDataset.java:67)

at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper.runQuery(SRConnectionWrapper.java:148)

at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities._runQuery(GatewayDBUtilities.java:117)

at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runQuery(AbstractDBUtilities.java:261)

... 25 more

java.lang.Exception: java.lang.Exception: Error executing system.db.runQuery(Select t_stamp, K909,K910,K911,K912,K861,DE1,DE2,DE3,DE4 FROM [SERVIDORDERECETAS].[dbo].[BisagrasPorton] where K861 = ‘PORT-BFW’ and t_stamp between ‘2018-12-5 06:00:00’ and ‘2018-12-6 05:59:59’, , )

at org.python.core.Py.JavaError(Py.java)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:293)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runQuery(AbstractDBUtilities.java:265)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:313)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx51.Exportacion$1(<module:ExportacionDatos>:17)
at org.python.pycode._pyx51.call_function(<module:ExportacionDatos>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx50.f$0(<TagChangeScript:MedicionBisagrasVS20/6AMBFW>:1)
at org.python.pycode._pyx50.call_function(<TagChangeScript:MedicionBisagrasVS20/6AMBFW>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:394)
at com.inductiveautomation.ignition.common.script.TagChangeScriptManager$TagChangeScriptHandler$Runner.run(TagChangeScriptManager.java:170)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

One of the datatypes in the columns returned is not supported by Ignition’s JDBC type mappings. Not sure why. Can you show that table’s schema?

1 Like

Hello
yesterday trying I got that I did not give the error. In this table the last 6 fields that are nvarchar type were called as variables of the script K861, K909, K910, K911, K912 and I have also changed the variable type from nchar to nvchar. And it works The first table was the error and the second the one that does not give an error.
I have Ignition V 7.2.6
Thanks


Seems like an incompatibility between your old Ignition version and your database. Have you tried upgrading your JDBC driver to a version known to match your database? You might want to get IA support involved, in spite of the end-of-life version of Ignition.

1 Like