473,766 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

commit and terminate

I have 8.1.5 on Windows 2003, when I do from CLP with auto commit off:
db2 update table set column=somethin g
and then
db2 terminate
and then
db2 connect to db
db2 select updated column from table
the update is committed anyways, whereas the docs state that the update
is supposed to be rolled back (auto commit is off)
Does this indicate a bug or a mistake in the docs?
If it is not a mistake in the docs, what is the point of having a
switch for auto commit if the terminate command over-rides the setting?

Dec 20 '05 #1
7 8773
I guess the documentation at this link must be wrong? Who knows?
http://publib.boulder.ibm.com/infoce...d/c0004859.htm

Dec 21 '05 #2
That documnetation is talking about the gerneric termination of a
transaction.

The command you used is TERMINATE, which is a very specific command,
detailed here:
<URL:http://publib.boulder. ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb .doc/core/r0001973.htm>

The usage note states: If an application is connected to a database, or
a process is in the middle of a unit of work, TERMINATE causes the
database connection to be lost. An internal commit is then performed.
B.

Dec 21 '05 #3
I dont mean to debate the issue, but could you explain what the
difference would be between 'generic termination' and the use of the
'terminate' command. If I understand correctly, (which obvioulsy I do
not lol), if I code an application and do an update as the last
transaction before coding 'terminate', and I do not give the commit or
rollback command before coding the terminate command, then presumably
that last update will be lost on Windows platform.
If I do the same thing from CLP, the update is committed because of the
internal commit.
Seems confusing to me and without much logic, especially considering
that the CLP has the command option to over ride the auto commit
setting.
So my question remains, why give the option to over ride the commit
behaviour if the behaviour is hard coded by default in the terminate
command?

Dec 21 '05 #4
fy***@hotmail.c om wrote:
transaction before coding 'terminate', and I do not give the commit or
rollback command before coding the terminate command, then presumably
that last update will be lost on Windows platform.
If I do the same thing from CLP, the update is committed because of the
internal commit.
Seems confusing to me and without much logic, especially considering
that the CLP has the command option to over ride the auto commit
setting.


You have to seperate "applicatio n terminates (ends) connection to
database" from "issue TERMINATE command in CLP".

Different topic, different task.

Bernd

--
"Ja, alles meine Herren" sprach Fürst Lichnowsky. "Ooch det roochen?"
"Ja, auch das Rauchen." "Ooch im Tiergarten?" "Ja, auch im Tiergarten
darf geraucht werden, meine Herren." Und so endeten die Barrikadenkämpf e
des 18. März in Berlin
Dec 21 '05 #5
The AUTOCOMMIT option treats any subsequent SQL statements as the last
statement in the current (or new) transaction. If it is successful, it
and every statement since the start of the last transaction are
COMMITted. If it fails, it and every statement since the start of the
last transaction are ROLLBACKed (should that be ROLLedBACK?). Note,
therefore, that AUTOCOMMIT can issue a ROLLBACK too. It does not mean
that each statement is COMMITed.

Ultimately, it is good practice to explicitly end transactions with
either COMMIT or ROLLBACK. Note though, CONNECT RESET is a SQL
statement (not a CLP command) that issues an implicit COMMIT.

TERMINATE is a CLP command (not a SQL statement) to close the backend
process. If there is an open transaction, it will end, the question is
how. Is the default a ROLLBACK or a COMMIT? As it just so happens,
TERMINATE does it with COMMIT.

B.

Dec 22 '05 #6

Brian Tkatch wrote:
The AUTOCOMMIT option treats any subsequent SQL statements as the last
statement in the current (or new) transaction. If it is successful, it
and every statement since the start of the last transaction are
COMMITted. If it fails, it and every statement since the start of the
last transaction are ROLLBACKed (should that be ROLLedBACK?). Note,
therefore, that AUTOCOMMIT can issue a ROLLBACK too. It does not mean
that each statement is COMMITed.

Ultimately, it is good practice to explicitly end transactions with
either COMMIT or ROLLBACK. Note though, CONNECT RESET is a SQL
statement (not a CLP command) that issues an implicit COMMIT.

TERMINATE is a CLP command (not a SQL statement) to close the backend
process. If there is an open transaction, it will end, the question is
how. Is the default a ROLLBACK or a COMMIT? As it just so happens,
TERMINATE does it with COMMIT.

B.


Yes, that is a very good distinction, I mean terminate being a CLP
command executable and not an sql statement. So that does make sense to
me, as does your suggestion that each and every transaction be
explicitly committed or rolled back. I also get your point about
connect reset, and also thank you for pointing out that autocommit can
also induce a rollback if the statement fails.
Thanks for the help and the explanation

Dec 23 '05 #7
You're most welcome.

B.

Dec 23 '05 #8

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

Similar topics

3
11626
by: DP | last post by:
Is there any command exists as "commit transaction" ? begin transaction < DML1 stmts > begin transaction < DML2 stmts > rollback transaction commit transaction which set of DML will be commites to the database or none ?
11
12719
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to read the new date. So process B starts "select ..." but does not get the previously inserted row. The timespan between commit and select is very short. (NOTE: two different sessions are used) Questions: 1.) Does commit when returning from call...
0
5397
by: Fan Ruo Xin | last post by:
Nothing got wrong with DB2 COMMIT, db2 cfg, ... Even you did an "insert some_id+1 ..." immediately after you did "select max(some_id) from .... " in session1. This will not block the operations which submitted by the other processes/threads. Before the INSERT, DB2 will not prevent the other SELECT MAX(some_id) from this table. So the following case could happen, Suppose in session A: Begin a transactionA Select max(id) from mytable;...
0
5727
by: JC | last post by:
I have surprising performance results running a simple Java program which inserts 1000 rows into the following simple table: create table TestTable (id int not null, comments varchar(255) not null); With group commit, the test runs in 3 seconds (one commit after the loop) With auto commit, the test runs in 15 seconds (default JDBC setting)
8
11748
by: Martin Staael | last post by:
When doing a UPDATE on a very large table it can take quite a long time due to the commit/rollback option. Is there any way on the client side to disable the commit/rollback option so that UPDATE will make any changes without requiring a commit - and hopefully be much faster? I'm aware of the 'db2 -c' option Best regards, Martin
3
8725
by: Mark | last post by:
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?
2
7470
by: janet | last post by:
HI, I had a question on auto-commit in DB2 EEE V8 on AIX V5. Here is my example.. there are two script A.sh , B.SQL A.sh is following:
9
3145
by: Anurag | last post by:
ENVIRONMENT: ============ (1) AIX 5.2 ML 8 and AIX 5.3 TL 4. (2) DB2 ESE on some servers and DB2 Connect Enterprise Edition on others. QUESTION: ========= I upgrade DB2 on some 15 Production servers using 'installFixPak -ay', from 8.1.4 to 8.1.11.
0
604
by: Jim Kennedy | last post by:
ALL DDL does a commit. Hence Drop Table movies; issues a commit. True you don't issue a commit and the driver does not issue a commit, but the server does for all DDL. That is probably where your commit is coming from. Jim -- Replace part of the email address: kennedy-down_with_spammers@attbi.com with family. Remove the negative part, keep the minus sign. You can figure it out.
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
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
8835
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...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
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...
1
3929
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
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.