runPrepUpdate uses default database instead of the specified database

Context:

  • I'm running Ignition v8.3.3
  • I have two database connections defined in the Gateway: "TA_Recipes" and "Ignition_DB"
  • "TA Recipes" is set as default database in the project.
  • In one of the button script, I need to insert data into "Ignition_DB". I tried to use runPrepUpdate with database specified as followed:

txId = system.db.beginTransaction(timeout=10000) query = "INSERT INTO Ignition_DB.lot_code_data (function_name, fo, ingredient_num, lot_code, actor, record_time) VALUES(?,?,?,?,?,?)"
fo = system.tag.readBlocking('[default]A200/Recipe/RECIPE_200RCV/PARAM/PARAM_2')[0].value
ingredient_num = event.source.parent.getComponent('selIngreSolid').selectedValue lot_code = event.source.parent.getComponent('txtLotCodeSolid').text
user = system.security.getUsername() datetime = time.strftime('%Y-%m-%d %H:%M:%S') args = ["FCT_RCV", fo, ingredient_num, lot_code, user, datetime] system.db.runPrepUpdate(query, args, database = "Ignition_DB", tx = txId) system.db.commitTransaction(txId) system.db.closeTransaction(txId)

However, when I press the button, it gives an error:

Traceback (most recent call last):
  File "<event:actionPerformed>", line 14, in <module>
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO Ignition_DB.lot_code_data (function_name, fo, ingredient_num, lot_code, actor, record_time) VALUES(?,?,?,?,?,?), [FCT_RCV, 999999, 101, Hello, JohnDoe, 2026-06-12 17:12:22], Transaction datasource 'TA_Recipes', c5be392d-6bd7-4b23-bd7e-b49d28453f0d, false, false)

	caused by Exception: Error executing system.db.runPrepUpdate(INSERT INTO Ignition_DB.lot_code_data (function_name, fo, ingredient_num, lot_code, actor, record_time) VALUES(?,?,?,?,?,?), [FCT_RCV, 999999, 101, Hello, JohnDoe, 2026-06-12 17:12:22], Transaction datasource 'TA_Recipes', c5be392d-6bd7-4b23-bd7e-b49d28453f0d, false, false)
	caused by SQLSyntaxErrorException: (conn=36138) INSERT command denied to user 'ignition'@'10.0.0.3' for table `Ignition_DB`.`lot_code_data`

Ignition v8.3.3 (b2026012009)
Java: Azul Systems, Inc. 17.0.17

It looks like runPrepUpdate still tries to use default database 'TA_Recipes' instead of the specified "Ignition_DB".

This only happens in Scripting. I tried to access this "Ignition_DB" by binding in a Data field of a Table: it works just fine.

Not sure what I missed here. Any help is appreciated.

You cannot use a transaction ID across DB connections. The entire transaction must use one DB.

Thank you!

I added the specified database in beginTransaction and it works:

txId = system.db.beginTransaction(database = "Ignition_DB", timeout=10000)