How to group a database write and spreadsheet write in single "transaction"
Posted
by WhyGeeEx
on Stack Overflow
See other posts from Stack Overflow
or by WhyGeeEx
Published on 2010-05-05T15:55:37Z
Indexed on
2010/05/05
16:08 UTC
Read the original article
Hit count: 246
I have a Java program that writes results to both a DB (SQL Server) and a spreadsheet (POI), and it would be best if neither is written to if there's an error with either.
It would be a lot worse if the spreadsheet was produced and then an error happened while saving to the DB, so I'm doing the DB-write first. Even so, I'm wondering if someone knows of a way to guarantee they both succeed or fail as a unit.
Thanks!
© Stack Overflow or respective owner