Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AutoCommit

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Campbell Ritchie
Marshal
Posts: 52632
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!