aspose file tools*
The moose likes JDBC and the fly likes Stored procedure & auto commit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Stored procedure & auto commit" Watch "Stored procedure & auto commit" New topic
Author

Stored procedure & auto commit

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

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


Regards,

Pho
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
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


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stored procedure & auto commit
 
Similar Threads
Data updated through stored proc is not retrieved by subsequent em.find() calls
Stored procedures and arrays/lists
Hybrid persistence layer ..?
Can I call a stored proc without wrapping it in a transaction?
BCP and Update