473,503 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Procedure commit point

If a java applicaiton using the type 4 driver calls a DB2 stored
procedure, does the stored procedure need to do its own commit when
updates are completed? If the stored procedure does a commit or
rollback, does that affect the UOW for any SQL that was directly
issued by the java program before calling the stored procedure?
Nov 12 '05 #1
3 8709
Mark wrote:
If a java applicaiton using the type 4 driver calls a DB2 stored
procedure, does the stored procedure need to do its own commit when
updates are completed? If the stored procedure does a commit or
rollback, does that affect the UOW for any SQL that was directly
issued by the java program before calling the stored procedure?

Commit operates on a transaction level.
From that imediately follows that a commit inside of a procedure will
commit whatever happened sinc ethe last commit/rollback independent on
whether that was inside the stored procedure or not.
Just the same a procedure will not implicitly commit.
It's the caller's responsibility.

Relation Information: Check out safepoints

Cheers
Serge
Nov 12 '05 #2
Serge Rielau <sr*****@ca.ibm.com> wrote in message news:<2u*************@uni-berlin.de>...
Mark wrote:
If a java applicaiton using the type 4 driver calls a DB2 stored
procedure, does the stored procedure need to do its own commit when
updates are completed? If the stored procedure does a commit or
rollback, does that affect the UOW for any SQL that was directly
issued by the java program before calling the stored procedure? Commit operates on a transaction level.


from a jdbc point of view, it operates on the Connection. since the
SP is executing on the other end of the Connection from the java
caller, and perhaps on a different thread in the caller jvm; i've
always wondered why it's better to have commit in the caller. seems
logically sounder to put Everything about the transaction in the SP.
conflicts with other jdbc calls from the original caller (same or
different caller thread) would be handled from a concurrency standpoint
by DB2 server process. yes/no/maybe??
From that imediately follows that a commit inside of a procedure will
commit whatever happened sinc ethe last commit/rollback independent on
whether that was inside the stored procedure or not.
Just the same a procedure will not implicitly commit.
It's the caller's responsibility.

Relation Information: Check out safepoints

Cheers
Serge

Nov 12 '05 #3
robert wrote:
Serge Rielau <sr*****@ca.ibm.com> wrote in message
news:<2u*************@uni-berlin.de>...
Mark wrote:
> If a java applicaiton using the type 4 driver calls a DB2 stored
> procedure, does the stored procedure need to do its own commit when
> updates are completed? If the stored procedure does a commit or
> rollback, does that affect the UOW for any SQL that was directly
> issued by the java program before calling the stored procedure? Commit operates on a transaction level.


from a jdbc point of view, it operates on the Connection.


which is just the same. A connection has only a single transaction running
at a certain point in time.
since the
SP is executing on the other end of the Connection from the java
caller, and perhaps on a different thread in the caller jvm; i've
always wondered why it's better to have commit in the caller. seems
logically sounder to put Everything about the transaction in the SP.
A stored procedure call is just like any other statement in a transaction.
You could run a bunch of INSERTs, an SP call, followed by some UPDATEs and
other things - all in the same transaction. If the SP would commit, it
would possibly screw up the callers transaction. And sometimes you just
don't know the circumstances and context in which a SP might be called. So
the general suggestion is to leave the transactional control with the
client who initiated the transaction in the first place.
conflicts with other jdbc calls from the original caller (same or
different caller thread) would be handled from a concurrency standpoint
by DB2 server process. yes/no/maybe??


If multiple threads work on the same connection, then they execute within
the same transaction. You can start a new connection from each thread,
though.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7893
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
1991
by: Leon | last post by:
How can I code a stored procedure "within my codebehind page" that execute two or more stored procedures within a transaction? if so how would I pass values to each parameter? i.e. Begin Tran...
7
9681
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
9
7283
by: Mark A | last post by:
Quoted from the: "Application Development Guide: Programming Server Applications Version 8.2": (DB2 for LUW). "Stored procedures cannot issue COMMIT or ROLLBACK statements if the stored...
2
6669
by: Chris | last post by:
In SQL 2005 I have a stored procedure as below: @sub_no smallint OUTPUT BEGIN BEGIN TRANSACTION INSERT...INTO
4
9085
by: lokesh.kris | last post by:
I'm having a tough time trying to run this stored procedure in DB2 UDB 8.1 environment. Can someone help me out here. All I'm trying to do here is update an indicator 'N' if it is a NULL....
1
7478
by: peaceburn | last post by:
Hi, I'm gonna pull my hair in the coming days with these DB2 stored procedures. So the issue, let's assume a simple stored procedure like this : CREATE PROCEDURE MYSCHEMA.PROCEDURE1 ( )...
2
10124
by: Eraser | last post by:
Hello, I'm just starting to learn PL/SQL. To get my feet wet, I'm trying to write a simple stored procedure that takes some values as parameters, and inserts those values into a table. For...
0
2115
by: a573851 | last post by:
I have a very lengthy stored procedure that I just inherited. Apparently this stored proc performs poorly. I am reviewing it to see where I can add some efficiencies. I would like to know if there...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.