• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Logging uncommitted transactions

 
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
 
author & internet detective
Posts: 39996
807
Eclipse IDE VI Editor Java
  • 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.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • 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.
 
Your mother is a hamster and your father smells of tiny ads!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic