• Post Reply Bookmark Topic Watch Topic
  • New Topic

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: 59461
187
  • 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.
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!