Hi all,
I was doing some JDBC work inside an UserTransation and observed the following.
1)It doesn't matter whether you had opened DB connection after or before calling begin() method of UserTransation. The only thing required is that statement.execute() should be called after the begin() method call.
2) Also, it doesn't matter whether you are closing DB connection after/before calling UserTransation.commit().
Can somebody validate my observation and provide me explanation of data being committed by TransactionManager even after the connection.close() is called (ie my second observation)?
Thanks & Regards
Manish.
-
UserTransaction and Database Connection (2 messages)
- Posted by: Manish Gupta
- Posted on: December 28 2003 06:39 EST
Threaded Messages (2)
- After Commit, connection release by Harish Madhavan on December 28 2003 09:28 EST
- UserTransaction and Database Connection by Sanjaya Ganesh on December 29 2003 07:51 EST
-
After Commit, connection release[ Go to top ]
- Posted by: Harish Madhavan
- Posted on: December 28 2003 09:28 EST
- in response to Manish Gupta
By practise, the db connections marked under transaction must be released before commit.This makes the connection object to participate in pooling.
A connection under a transaction is not shared ! -
UserTransaction and Database Connection[ Go to top ]
- Posted by: Sanjaya Ganesh
- Posted on: December 29 2003 07:51 EST
- in response to Manish Gupta
Manish:
It makes perfect logical sense for what you observed to be true. Because by default most TMs enlist open connections in the current thread as txns start on "that thread" (THread ID based).
-Sanjay