• 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Problem while rolling back in Java with Oracle SQL  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am currently using database oracle 11g and jdk 1.6.0_17.

In my java code, first I have set the auto commit to false so that I can rollback it later if any exception occurs.
After that there are few SQL procedures which i call.(There is no commit statement inside these procedures)
After that if there is an exception then i just do conn.rollback() and in the finally block i have closed the connection.

However the rollback is happening partially only.
If the exception is thrown halfway then all the changes in the database are rollbacked.
But if exception occurs near the end of the code execution then the same changes (which were rollbacked earlier when exception was thrown halfway) are not rollbacked completely. Only few changes are rolbacked.

I am quite positive that there is no explicit commit or any DDL statement in the code.

Please help me with this issue!!!


 
Marshal
Posts: 62239
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I think you will have to show us the code and SQL before we can help.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post full JDBC block of code
 
Rancher
Posts: 506
15
Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to rollback transaction changes partially using save points. A save point is set on the same connection which is being used to start the transaction.
 
Run away! Run away! Here, take this tiny ad with you:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!