Thread View: borland.public.jbuilder.java.api
2 messages
2 total messages
Started by Scott
Sun, 13 Jun 2004 19:48
Distributed transactions?
Author: Scott
Date: Sun, 13 Jun 2004 19:48
Date: Sun, 13 Jun 2004 19:48
21 lines
1557 bytes
1557 bytes
Hi, We are writing a web application in Cold Fusion. But in a few places it looks like the app will need to write data to at least two different databases and maintain transaction integrity. CF runs as a J2EE application so we are evaluating tapping into the underlying JVM to do these critical database writes. Is it possible using JDBC to manage transactions this way? Would it be enough to open the two connections I need (turning auto commit off), issue my two statements and if either fails, rollback both transactions (or commit if there are no errors)? Or do we need to look to JTA for distributed transactions? Any advice appreciated. Thanks Scott
Re: Distributed transactions?
Author: Tad Frysinger
Date: Mon, 14 Jun 2004 16:29
Date: Mon, 14 Jun 2004 16:29
39 lines
2505 bytes
2505 bytes
Scott wrote: > Hi, > > We are writing a web application in Cold Fusion. > > But in a few places it looks like the app will need to write data to at > least two different databases and maintain transaction integrity. > > CF runs as a J2EE application so we are evaluating tapping into the > underlying JVM to do these critical database writes. > > Is it possible using JDBC to manage transactions this way? Would it be > enough to open the two connections I need (turning auto commit off), issue > my two statements and if either fails, rollback both transactions (or commit > if there are no errors)? > > Or do we need to look to JTA for distributed transactions? > > Any advice appreciated. > > Thanks > Scott > > I don't think you are going to want to go down the "issue two statements " route. What happens if statement A succeeds in the commit but statement B doesn't? You will have to manually roll back, which is doable but a pain in the butt. You really need to coordinate the two statements. JTA is exactly what does this - you do need to make sure that the various pieces are "JTA aware". But then you separate out your transaction logic separate from the data access. Transaction begin..end..commit is handled entirely within JTA. The actual objects that do the data updates can create Connection objects, etc. and even close them - JTA takes care of rolling back the entire thing for you if necessary. -- Tad Frysinger [TeamB]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads