Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stored procedure & auto commit

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have my SQL code inside a stored proc and I want the store proc to execute within a transaction; does setting the autocommit to false achieve this or do I need to
do a BEGIN TRANSACTION/END TRANSACTION within the stored proc.
Another related question is that I've set the
isolation level to "Serializable" in the connection object. Is this enough to achieve the above ?
Thanks
Pho
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as autocommit is off, then you don't need begin / end transaction in your stored proc.
The database will get your drift and wrap it all in one transaction with your other DB operations.

Adam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic