File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes TX in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "TX in servlets" Watch "TX in servlets" New topic

TX in servlets

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

My web application uses DataSource as the interface of database operations.
My servlet has to group the following operation in a single transaction :
// insert new record in table1
// insert new record in table2
// update a row in table3
How to use transaction here ?
Should I use TransactionManager (JTA) ? or use original transaction like setAutoCommit( ) ?
In the case if I have to use JTA, I have to put jta.jar in Tomcat classpath, right ?
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

Hi todd..

i think if u use small TX better go for the SetCommit();
at last once all the Tx are sucess else roll back i think as far as my knowledge and expis concerned if u have time and ur appln extends more ..its reallly better t use JTA...

Let me know if it is OK

Thx and Regards
G R Ganesh Gowtham
Capricornsys inc, Hyderabad

Thanks, Ganesh Gowtham
I agree. Here's the link:
subject: TX in servlets
It's not a secret anymore!