Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Servlets
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Servlets
user transaction from servlet or a nornal java class
anil bisht
Ranch Hand
Posts: 81
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi,
How can i use the user transaction from a
servlet
or a normal jave class. Its basically how can i get the user transaction object to start the transaction.
A piece of code could be helpful
TIA
Anil
Junaid Bhatra
Ranch Hand
Posts: 213
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You would basically get it from the Context. For eg:
try { Context context = new InitialContext(); UserTransaction utx = (UserTransaction)context.lookup("javax.transaction.UserTransaction"); utx.begin(); //do some work here... utx.commit(); } catch(Exception e) { //deal with the exception, maybe rollback() the transaction... }
[ May 03, 2002: Message edited by: Junaid Bhatra ]
anil bisht
Ranch Hand
Posts: 81
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This line gives me error..
UserTransaction utx = (UserTransaction)context.lookup("javax.transaction.UserTransaction
how do i bind the name ??
Regrds
Anil
Space pants. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to handle transaction in DAO
reg. container transactions
Regarding understanding of EJB Container Managed Transaction Attributes
servlet and stateful session bean maintain user session(C app calls Java servlet more than once)
making instance variables thread safe...
More...