aspose file tools*
The moose likes JDBC and the fly likes doing transaction using jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "doing transaction using jdbc" Watch "doing transaction using jdbc" New topic
Author

doing transaction using jdbc

Vijji, Thomas
Greenhorn

Joined: Jun 16, 2001
Posts: 1
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


SeE Consulting (P) Ltd<BR>New Delhi
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
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

Joined: Feb 06, 2001
Posts: 358
--------------------------------------------------------------------------------
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);


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doing transaction using jdbc