This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes commit statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "commit statement" Watch "commit statement" New topic
Author

commit statement

tribhuwan soni
Greenhorn

Joined: May 23, 2007
Posts: 6
can i use commit statement in update , select and insert querry


regards,

TRIBHUWAN SONI
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

Tribhuwan,


Commit applies your update, insert or delete transactions to the database,
and makes these transactions available for all users.
In the most simple form, if you want to use transactions in JDBC:
You turn off your connection's auto commit functionality.
You perform your update queries (update, insert delete).
You do a commit by calling your database connection's commit().

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38513
    
  23
If you are going to commit all the time, consider using a transaction which includes "commit" at its end.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
If you are going to commit all the time, then do not do anything as autocommit is defaulted to true.


Rahul Bhattacharjee
LinkedIn - Blog
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38513
    
  23
Originally posted by Rahul Bhattacharjee:
If you are going to commit all the time, then do not do anything as autocommit is defaulted to true.
Yes, I forgot that.
 
 
subject: commit statement