runPrepUpdate BigInteger

Why am I receiving this error when I try and run and update query?

[quote]Traceback (innermost last):
File “event:actionPerformed”, line 15, in ?
java.lang.Exception: Error executing system.db.runPrepUpdate(UPDATE tblAdmin_GP_POS_ItemCodes SET ITEMCODE=? WHERE ID=?, [A90XW20A, 5906], , , false)

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

at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:218)

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._pyx20.f$0(<event:actionPerformed>:15)

at org.python.pycode._pyx20.call_function(<event:actionPerformed>)

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.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:139)

at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:247)

at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)

at $Proxy0.actionPerformed(Unknown Source)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.awt.EventQueue.access$000(Unknown Source)

at java.awt.EventQueue$1.run(Unknown Source)

at java.awt.EventQueue$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)

at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue$2.run(Unknown Source)

at java.awt.EventQueue$2.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 202: Error executing prepared statement. Unknown class ‘BigInteger’ at argument 1

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:280)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:276)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runPrepStmt(GatewayInterface.java:457)

at com.inductiveautomation.ignition.client.script.ClientDBUtilities._runPrepStmt(ClientDBUtilities.java:71)

at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:216)

... 54 more

java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(UPDATE tblAdmin_GP_POS_ItemCodes SET ITEMCODE=? WHERE ID=?, [A90XW20A, 5906], , , false)

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.runPrepUpdate(AbstractDBUtilities.java:218)
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._pyx20.f$0(<event:actionPerformed>:15)
at org.python.pycode._pyx20.call_function(<event:actionPerformed>)
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.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:139)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:247)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at $Proxy0.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.2.8 (b178)
Java: Sun Microsystems Inc. 1.6.0_26
[/quote]

Thank you,

Dumb question: is your query encapsulated in quotes?

this is what is looks like in code

system.db.runPrepUpdate("UPDATE tblAdmin_GP_POS_ItemCodes SET ITEMCODE=? WHERE ID=?", [item["ITEMCODE"],item["ID"]])

The key here is :

[tt]Error executing prepared statement. Unknown class ‘BigInteger’ at argument 1[/tt]

Try putting int() around your params, like

system.db.runPrepUpdate("UPDATE tblAdmin_GP_POS_ItemCodes SET ITEMCODE=? WHERE ID=?", [int(item["ITEMCODE"]), int(item["ID"])])

Note: I doubt the item code “A90XW20A” is supposed to be an int :stuck_out_tongue:
But yeah, try that for the ID.

yes that worked. will there be a problem when the integer gets really big?

Well you should technically only have problems if you excede the capabilities of the long datatype, which is 9223372036854775807.

It’s just Python being somewhat silly about casting it’s number datatype to Java’s Object type in the absence of any useful type information for it to use as a hint.

This is something that we can improve on our end.

I have the same problem as described in the above post, but in my case the int() conversion does not work.
Here is the error:

Traceback (most recent call last):
  File "<event:actionPerformed>", line 38, in <module>

java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO proddaten_log (id, startzeit, matnr, gewicht) values (?,?,?,?), [411, 1351862541203, 2865100, 1.280000], energiemgmt, , false)

	caused by Exception: Error executing system.db.runPrepUpdate(INSERT INTO proddaten_log (id, startzeit, matnr, gewicht) values (?,?,?,?), [411, 1351862541203, 2865100, 1.280000], energiemgmt, , false)
	caused by GatewayException: Error executing prepared statement. Unknown class 'BigInteger' at argument 1

Ignition v7.5.4-beta4 (b1182)
Java: Sun Microsystems Inc. 1.6.0_34

The runPrepUpdate is excecuted in a client button script. I also tried long() instead of int() with the same result. The target column is a MySQL BigInteger, the value itself is a timestamp.

system.db.runPrepUpdate("INSERT INTO proddaten_log (id, startzeit, matnr, gewicht) values (?,?,?,?)", [anlage, int(neueStartzeitMS), matnr, gewicht], "energiemgmt")

The query works if i insert the value directly into the query, but i don’t really like that solution.

I believe a fix is in the works for this.

viewtopic.php?f=70&t=8964&p

That’s correct, there is a bug ticket made for this. I will add the information about int() casting not working for you, thanks.