# Database transaction support

**URL:** <https://forum.inductiveautomation.com/t/database-transaction-support/1711>\
**Category:** Ignition\
**Created:** [April 1, 2010, 8:57am UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711 "2010-04-01T08:57:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [April 1, 2010, 8:57am UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/1 "2010-04-01T08:57:40Z")

</div>

What’s the timescale for support for database transactions in Ignition?

---

<div class="post-metadata">

**Author:** ![bryan\_cook](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@bryan\_cook](https://forum.inductiveautomation.com/u/bryan_cook)\
**Post date:** [April 1, 2010, 2:42pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/2 "2010-04-01T14:42:09Z")

</div>

Ignition has the [SQL Bridge Module](http://www.inductiveautomation.com/products/ignition/modules) … same functionality as FactorySQL … is this what your speaking of?

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [April 1, 2010, 2:47pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/3 "2010-04-01T14:47:06Z")

</div>

No, [this](http://en.wikipedia.org/wiki/Database_transaction).

---

<div class="post-metadata">

**Author:** ![dep05d](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@dep05d](https://forum.inductiveautomation.com/u/dep05d)\
**Post date:** [April 1, 2010, 4:05pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/4 "2010-04-01T16:05:56Z")

</div>

What types of transactions would you be looking to manage? Basic transaction groups are just doing a single sql statement (insert, update), but if you needed something else like business logic or data validation/lookups, couldn’t you just wrap all that up in a stored procedure and handle commits/rollbacks there?

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [April 1, 2010, 5:40pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/5 "2010-04-01T17:40:31Z")

</div>

I think he’s looking more for transaction support in the scripting language, so that from Jython scripts you could use/manage transactions. This would be useful for more complicated scenarios in the Vision module, like inserting/updating several related records off of a button press.

It’s something that we’re definitely going to do sometime soon, though I don’t have an exact time frame.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [April 1, 2010, 6:56pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/6 "2010-04-01T18:56:59Z")

</div>

It shouldn’t be very tough for us to add this. I’ve scheduled it into the 7.1 timeframe.

---

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [April 2, 2010, 12:15am UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/7 "2010-04-02T00:15:38Z")

</div>

Hmmm, I’ve been doing this all along. Do you mean something besides something like this?

q= "BEGIN TRANSACTION "

(A whole bunch of python code that creates a long sql transaction)

q+= " COMMIT "  
system.db.runUpdateQuery(q)

I do this a lot when I have to initialize some starting production data with, say, 1000 parts, or update several different tables at once. The one thing I couldn’t get working (Bobby saw the same thing) is using scope\_identity() inside the query. It would be cool to be able to do that, since I then wouldn’t have to break the query up into several queries just to get the key with system.db.runUpdateQueryGetKey().

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [April 2, 2010, 3:57am UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/8 "2010-04-02T03:57:33Z")

</div>

But in this example you send the queries to the database all at once. What would be nice is if you could start a transaction, issue many queries via separate calls to runUpdateQuery, and then commit or rollback.

---

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [April 2, 2010, 3:55pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/9 "2010-04-02T15:55:43Z")

</div>

Ok, I’m trying to learn something. What is the advantage of doing it with multiple calls vs one call? Is it so you could first analyze the result of the previous queries as you go through them, and then roll them back at any time if you so choose?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [April 2, 2010, 6:36pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/10 "2010-04-02T18:36:30Z")

</div>

Yep, thats right. There are various reasons why you might not be able to know all the queries you’ll want to issue in advance.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [August 11, 2010, 11:05pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/11 "2010-08-11T23:05:31Z")

</div>

Transaction support has been added for Ignition 7.1.5

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [August 12, 2010, 9:14am UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/12 "2010-08-12T09:14:04Z")

</div>

That’s great Carl. Any idea when this will be released? I downloaded version 7.1.5.5650-beta7 but there is no sign of transaction support (at least in the documentation).

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [August 13, 2010, 9:34pm UTC](https://forum.inductiveautomation.com/t/database-transaction-support/1711/13 "2010-08-13T21:34:32Z")

</div>

Today.
