File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes doing transaction using jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "doing transaction using jdbc" Watch "doing transaction using jdbc" New topic

doing transaction using jdbc

Vijji, Thomas

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.
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.
// your
// SQL statements
// will go here

Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
I agree. Here's the link:
subject: doing transaction using jdbc
jQuery in Action, 3rd edition