aspose file tools*
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
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: 2477
    
    7

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: 36514
    
  16
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: 36514
    
  16
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
 
Similar Threads
When is exclusive lock released
Rolling back Oracle DDL
problems with batch update
Closing Statement object prior to committing
problem related to locking the table