| Author |
AutoCommit
|
Arjun Reddy
Ranch Hand
Joined: Nov 10, 2007
Posts: 624
|
|
Hi, I have a basic question. Every time we write JDBC Code, is it better that we do Connection.setAutoCommit(false); at the beginning and at the end, do, Connection.commit(); Connection.setAutoCommit(true) and close the connection? Thanks. [ June 27, 2008: Message edited by: Arjun Reddy ]
|
Be Humble... Be Nice.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
Yes, but it is probably better still to use a transaction, which does all that sort of thing implicitly. Also a transaction will roll back your database if an error occurs. Maybe better again to use a stored procedure which embodies a transaction.
|
 |
 |
|
|
subject: AutoCommit
|
|
|