IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to set Auto Commit turned off in DB2 stored proceudre.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Munish Singla

New User


Joined: 18 Jul 2007
Posts: 21
Location: kolkata

PostPosted: Thu Jan 15, 2009 7:15 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 15, 2009 7:29 am
Reply with quote

Hello,

Is this what you are looking for (commit on return)?

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/dsnsqj10/5.34?
Back to top
View user's profile Send private message
Munish Singla

New User


Joined: 18 Jul 2007
Posts: 21
Location: kolkata

PostPosted: Thu Jan 15, 2009 11:07 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 15, 2009 11:46 pm
Reply with quote

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
View user's profile Send private message
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Fri Jan 16, 2009 2:06 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 16, 2009 2:16 am
Reply with quote

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
View user's profile Send private message
Munish Singla

New User


Joined: 18 Jul 2007
Posts: 21
Location: kolkata

PostPosted: Fri Jan 16, 2009 4:19 am
Reply with quote

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
View user's profile Send private message
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Fri Jan 16, 2009 9:45 pm
Reply with quote

Hi Dick,

AUTO COMMIT - I mean the Unit of Work is automatically getting Committed after successful completion of the program. Please note it is not a key word. Sorry, i should not have given this in Caps letter

Please refer the below link.

publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/r0010308.htm
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jan 17, 2009 4:19 am
Reply with quote

Hi Suresh,

Quote:
Sorry, i should not have given this in Caps letter
Not a problem icon_smile.gif

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 icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Invoke stored procedure via batch JCL. DB2 2
No new posts Library member auto insert option TSO/ISPF 3
No new posts Calling COBOL DB2 program from a COBO... COBOL Programming 2
This topic is locked: you cannot edit posts or make replies. Internal Autonomous Stored Procedure ... DB2 6
No new posts Stored procedure cpu utilization DB2 1
Search our Forums:

Back to Top