View previous topic :: View next topic
|
Author |
Message |
Munish Singla
New User
Joined: 18 Jul 2007 Posts: 21 Location: kolkata
|
|
|
|
Hi,
I want to turn off Auto Commit option in DB2 stored procedure turned off.
Could you please help in doing this.
Thanks,
Munish |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
Munish Singla
New User
Joined: 18 Jul 2007 Posts: 21 Location: kolkata
|
|
|
|
Thanks for your reply.
My requirement is I don't want any SQL statement to auto commit inside stored procedure. I want the commit the whole SP after successful operation of each SQL otherwise I need to rollback it.
So is there any statement through which we can set AutoCommit option to false explicitly.
Thanks,
Munish |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
So is there any statement through which we can set AutoCommit option to false explicitly. |
I believe that is what the link describes. Did you read the part about "commit on return"? Did you try setting "commit on return" in your "create procedure"? If not, why not? It this was tried, what happens? |
|
Back to top |
|
|
Suresh Ponnusamy
Active User
Joined: 22 Feb 2008 Posts: 107 Location: New York
|
|
|
|
Hi Munish
COMMIT ON RETURN - YES/NO - In either case AUTO COMMIT will not be performed on succesful execution of each SQL statement inside the SP.
COMMIT ON RETURN - YES - On successful execution of the SP, all changes made to the tables would be committed.
COMMIT ON RETURN - No - Changes would not be committed until explicitly COMMIT is used. Generally when SP is called from JAVA, the commit operation will be performed at the front end.
Hope this helps, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Suresh,
I couldn't find "auto commit" in the manual and thought "commit on return" might apply. . . .
Where is "auto commit" described?
Thanks,
d |
|
Back to top |
|
|
Munish Singla
New User
Joined: 18 Jul 2007 Posts: 21 Location: kolkata
|
|
|
|
Thanks.
Yes I tried "Commit on Return" statement.
When I specify "Commit on Retutn No" , it is getting compiled successfully.
But when I specify "Commit on Return Yes" it is not getting build.
I have specified the statement at the end of Create Procedure statement.
It is giving the following error
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "BEGIN" was found following " COMMIT ON RETURN
". Expected tokens may include: "NO". LINE NUMBER=18. SQLSTATE=42601
SQL0104N An unexpected token "BEGIN" was found following "
COMMIT ON RETURN
". Expected tokens may include: "NO
Please suggest.
Thanks
Munish |
|
Back to top |
|
|
Suresh Ponnusamy
Active User
Joined: 22 Feb 2008 Posts: 107 Location: New York
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Suresh,
Quote: |
Sorry, i should not have given this in Caps letter |
Not a problem
Thanks for the link.
Hi Munish,
If this is not yet working, it may help us help you if you post the code. . .
If it is working, please advise - your solution could help someone else later |
|
Back to top |
|
|
|