Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging uncommitted transactions

 
Saira Murty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I want to log information about all uncommitted transactions before calling rollback. or during roll back.
Is there any way to do that?
In my code,I have
setAutocommit(false)
executeQuery()
con.close();
performRollback();

Now in performRollback()is there any way to know about uncommitted transaction?

Saira
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saira,
You would have to keep track of the relevant information yourself.

Note that you cannot do a rollback after you close the connection.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saira,
Transactions only apply to operations that manipulate the data in the database -- in other words when you do DELETE, INSERT or UPDATE operations. Since (in the code you posted) you are calling the "executeQuery()" method, I assume you are performing a query. Since a query does not manipulate data, the "rollback" is redundant -- or am I missing something?

Most databases do not offer a way to access details of non-committed transactions, but if they do, then it is usually a proprietary way. So if database independence is important to you, I don't think your task is achievable.

Good Luck,
Avi.
 
Saira Murty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avi, thanks for your reply. I have jsut posted a pseduo code. the meaning of executeQuery is performing some SQL update. and in con.close() I am releasing the connection and putting it back to pool.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic