Am I using the database transaction correctly? It appears to me that the transaction timeout is not be reset because when I select a small amount of rows it works fine. A large set of rows throws the error.
I am receiving this error
[quote]Traceback (innermost last):
File “event:actionPerformed”, line 12, in ?
java.lang.Exception: Error executing system.db.runPrepUpdate(UPDATE [DepManager].[dbo].[tblDepletions] SET Sales=NULL WHERE DepletionID=?, [874779], , eb744ff7-8e08-4df8-bdfc-e131514ef72c, false)
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Connection Error: Transaction “eb744ff7-8e08-4df8-bdfc-e131514ef72c” is closed.
Caused by: java.sql.SQLException: Transaction “eb744ff7-8e08-4df8-bdfc-e131514ef72c” is closed.
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(UPDATE [DepManager].[dbo].[tblDepletions] SET Sales=NULL WHERE DepletionID=?, [874779], , eb744ff7-8e08-4df8-bdfc-e131514ef72c, false)
Ignition v7.3.2 (b533)
Java: Sun Microsystems Inc. 1.6.0_29
[/quote]
when i run this code
[code]dateID = event.source.parent.getComponent(‘Date’).intDateID
databaseName = event.source.parent.databaseName
rows = event.source.parent.getComponent(‘Table’).getSelectedRows()
dsPyData = fpmi.dataset.toPyDataSet(event.source.parent.getComponent(‘Table’).data)
txID = system.db.beginTransaction(timeout=5000)
for rowNum in rows:
system.db.runPrepUpdate(“UPDATE “+databaseName+”[tblDepletions] SET Sales=NULL WHERE DepletionID=?”,[row[“DepletionID”]],tx=txID)
system.db.commitTransaction(txID)
system.db.closeTransaction(txID)
fpmi.db.refresh(event.source.parent.getComponent(‘Table’),“data”)
event.source.parent.getComponent(‘Table’).selectedRow = -1[/code]
Thank you,