system.db.runPrepUpdate throws java.lang.Exception (again)

My Perspective table’s onEditCellCommit script contains the line

			system.db.runPrepUpdate(
				"UPDATE passwords SET %s = ? WHERE (area = ? AND location = ? AND system_name = ?)" % (c), 
				[v, a, l, s], dbConn
			)

which generates the following console error when I try to edit the system_name column.

20:12:07.608 [AWT-EventQueue-0] ERROR com.inductiveautomation.ignition.client.util.gui.ErrorUtil - Error running action 'component.onEditCellCommit' on subViews/viewPasswordsOriginal@D/root/Table: Traceback (most recent call last):
  File "<function:runAction>", line 26, in runAction
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(
    UPDATE passwords SET system_name = ? 
    WHERE (area = ? AND location = ? AND system_name = ?), 
    [King 5818 test2, CC, Cleanroom 1, King 5818 test1], 
    engpasswords, , false, false)

(Code and error lines have been wrapped to improve readability.)

The variables all seem to be set correctly in the error message. Can anyone see what might by triggering the error?

Is there no more to the stack trace than that? Normally you can see the error the database throws at you which lets you know if a column didn’t meet a definition or a constraint was violated etc.

Yes, there was, thank you. The console seemed on initial readings to be multiple repeats of the same message but there was some additional information at the bottom:

Caused by: com.inductiveautomation.ignition.common.GenericTransferrableException: 
Datasource "engpasswords" does not exist in this Gateway.

I had named the database as engpasswords but had named the gateway connection as dbengpasswords. Changing the script to

	dbConn = "dbengpasswords"

eliminated the error.

Thank you!

1 Like