# runPrepUpdate uses default database instead of the specified database

**URL:** <https://forum.inductiveautomation.com/t/runprepupdate-uses-default-database-instead-of-the-specified-database/115992>\
**Category:** Ignition\
**Tags:** vision, ignition83, scripting, database\
**Created:** [June 15, 2026, 8:50pm UTC](https://forum.inductiveautomation.com/t/runprepupdate-uses-default-database-instead-of-the-specified-database/115992 "2026-06-15T20:50:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddam](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@ddam](https://forum.inductiveautomation.com/u/ddam)\
**Post date:** [June 15, 2026, 8:50pm UTC](https://forum.inductiveautomation.com/t/runprepupdate-uses-default-database-instead-of-the-specified-database/115992/1 "2026-06-15T20:50:14Z")

</div>

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:

```python
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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 15, 2026, 9:41pm UTC](https://forum.inductiveautomation.com/t/runprepupdate-uses-default-database-instead-of-the-specified-database/115992/2 "2026-06-15T21:41:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ddam](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@ddam](https://forum.inductiveautomation.com/u/ddam)\
**Post date:** [June 15, 2026, 9:51pm UTC](https://forum.inductiveautomation.com/t/runprepupdate-uses-default-database-instead-of-the-specified-database/115992/3 "2026-06-15T21:51:27Z")

</div>

Thank you!

I added the specified database in beginTransaction and it works:

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

```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 16, 2026, 3:28pm UTC](https://forum.inductiveautomation.com/t/runprepupdate-uses-default-database-instead-of-the-specified-database/115992/4 "2026-06-16T15:28:46Z")

</div>

Sorry to be late on this one.

I usually tell new users (and in my case, it's the guys under me) to always specify the database connection. That way there are no unfortunate surprises like what happened to you. 🙂
