473,659 Members | 2,663 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 8717
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
7933
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 created a temporary database with a tables space. Verified that DECLARE GLOBAL TEMPORARY TABLE TEMP (A INTEGER); INSERT INTO SESSION.TEMP VALUES(10); SELECT A FROM SESSION.TEMP; works from a query tool.
2
1998
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 exec sp1 exec sp2 Commit Tran .....of course some error checking.
7
9703
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 for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for doing it like this is that I also have had a problem in the past where the SP takes longer than the...
9
7308
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 procedure was invoked from an application that established a type 2 connection to the database." 1. Is this accurate? 2. If a stored procedure is tested from the CLP (using type 2 connection to
2
6681
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
9104
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. Approximately 8 million rows will be updated as a result. I'm a newbie to DB2 and writing my first SP. The problem is that Stored Proc doesnt seem to update any rows eventhough I have set the commits after every row. CREATE PROCEDURE DWCRM.POST_CD_UPD...
1
7508
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 ( ) DYNAMIC RESULT SETS 1 ------------------------------------------------------------------------
2
10148
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 some reason my simple procedure is not working, I'm probably missing something simple. Here is how I'm trying to create this procedure: CREATE OR REPLACE PROCEDURE insert_person(uid IN NUMBER,
0
2128
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 are any tips/tools/doc available that could assist me in UDB stored procedure performance. I see a lot out there on SQL Server, but I can't seem to find any tips for UDB. The procedure is as follows: DROP SPECIFIC PROCEDURE...
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8626
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.