Keepalive sql transaction

260 views Asked by At

I have a simple problem with sql transactions. I connect to my database in method A and start a sql transaction. At the end of the method I close the connection, because the calculation (external method) takes a long time.
After finishing the calculation I want to commit or rollback the transaction, but I need the same connection.

Is there any other possibility to get it running?

2

There are 2 answers

1
Andy On BEST ANSWER

The only thing I can think of is to not do any writing in the half, then you won't have to do anything if you decide to rollback later on.

0
David Schwartz On

I would use the SQL transaction model for an operation that needs to remain open for a long period of time. Depending on what you're actually doing, there's probably a superior solution. It might involve a "calculation in progress" SQL table, it might not.