File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doing transaction using jdbc

 
Vijji, Thomas
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my program the trancaction gets closed after an insert . It is not wating for commit or rollback to finish the transaction.
Urgent help required
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that the default is for auto-commit is true.
setAutoCommit must be false, and then you can use commit.
HTH
Dan
 
rani bedi
Ranch Hand
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
--------------------------------------------------------------------------------
When a connection is created, it is in auto-commit mode. This means that each individual SQL statement is treated as a transaction and will be automatically committed right after it is executed.
The last thing you can try is disable auto-commit mode and then commit the transaction. Later you can enable the auto commit mode.
con.setAutoCommit(false);
// your
// SQL statements
// will go here
con.commit();
con.setAutoCommit(true);
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic