This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JSP and the fly likes Maintaining transactions in a jsp application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Maintaining transactions in a jsp application" Watch "Maintaining transactions in a jsp application" New topic

Maintaining transactions in a jsp application

Rajen Seth

Joined: Sep 22, 2003
Posts: 4
This question was asked in an interview. I guess lot of people here must be knowing the solution.
In an ecommerce application using jsp/servlet etc , when we make a connection to payment server(ex:verisign) for creditcard processing, we get the transaction results from the payment server and they need to be put in the database. But, if we make a request and the internet connection is down by the time the payment server sends the results, how do we get the results and store them in db?
Any takers please...
thanks in adv,
Nag Rao

Joined: Aug 11, 2003
Posts: 3
You should rollback such transactions.Also server should have the capacity to cancel the request after sometime if it can't send the results back.
But I would like to here from other folks what they think.
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
You could look into using JMS (see Java Message Service API) as a mechanism for guaranteeing that the requests are processed. The idea is that you put a request on a JMS queue (the request might include JDBC transactions, etc) and even if the database was down, the request would be queued and then processed when the database became available. I believe that JMS can be used outside of a J2EE container. There are several commercial implementations of JMS, as well as some that you can try [use?] for free.
Rajen Seth

Joined: Sep 22, 2003
Posts: 4
Thank you both for the replies.
It is sorta covered in the JavaRanch Style Guide.
subject: Maintaining transactions in a jsp application