It's not a secret anymore!*
The moose likes JDBC and the fly likes When use Batch update,would i must setAutoCommit(false)?? 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 "When use Batch update,would i must setAutoCommit(false)??" Watch "When use Batch update,would i must setAutoCommit(false)??" New topic
Author

When use Batch update,would i must setAutoCommit(false)??

alex han
Ranch Hand

Joined: Dec 13, 2002
Posts: 46
i have code like this
Ram Mohan
Ranch Hand

Joined: Jan 19, 2004
Posts: 44
the whole idea of a Batch Update is to write to the database as little as possible. Only when auto commit is set off, will the data be committed only at the end of the transaction. That way the entire transaction can take place or fail. Though not a rule, i guess it's better to follow this convention


If quitters never win, and winners never cheat, who's the idiot that said: Quit while you're ahead?
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
Good question - let me clarify -
"Are JDBC batch executes automatically wrapped in a transaction?"
My guess is no. I would put the auto-commit statements in there. Can't hurt!
alex han
Ranch Hand

Joined: Dec 13, 2002
Posts: 46
thanks
 
Consider Paul's rocket mass heater.
 
subject: When use Batch update,would i must setAutoCommit(false)??