473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Rollback on a DB2 table doesnt rollback the data - VB.NET app

Hi Guys,

We have a VB.NET 2005 app that uses IBM.Data.DB2.iSeries provider to connect to our DB2 server.

The connection string for the DB2 connection is set as -
"Data Source=<server>;User ID=<UID>;Password=<pwd>;ConnectionTimeout=120;"

And this is how we are updating a table in the DB2 server (using transactions) -

Expand|Select|Wrap|Line Numbers
  1. Dim cnDB2 as new iDB2Connection(<connString>)
  2. Dim TransDB2 as iDB2Transaction = nothing
  3. dim cmdDB2 as new iDB2Command
  4.  
  5. cnDB2.Open
  6. TransDB2 = cnDB2.BeginTransaction
  7. with cmdDB2
  8.     <various command object properties including
  9.      .Connection = cnDB2
  10.      .Transaction = TransDB2 >
  11. end with
  12.  
  13. for I as integer = 0 to 5
  14.      <set cmdDB2 parameter values>
  15.      cmdDB2.executeNonQuery
  16. 'if error occurred - do rollback
  17.      if cmdDB2.ReturnCode = 100 then     
  18.           TransDB2.Rollback
  19.           return false
  20.      end if
  21. next I
  22.  
  23. 'if no errors, commit the entire batch
  24. TransDB2.Commit
  25. return true
  26. Exit Sub
  27.  
What is happening is, when return code is 100, the Rollback line is executed. But when I check the data in DB2, the table has the new data. Why is this happening and how do I prevent this? It seems with SQL it is pretty straight-forward. But in DB2, I am reading reports of AutoCommit set to ON by default, etc. If I can set it to OFF, will that solve this issue? If so, how do I set it in the app?

Any help will be greatly appreciated. I have been stumped by this for the last 4 hours. Please help.

Thanks,
Sree
Oct 20 '14 #1
0 1126

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mark Vuksani | last post by:
Hi, I have a trigger like this (simplified to illustrate the problem): -------- CREATE TRIGGER Test ON . FOR INSERT, UPDATE, DELETE AS RAISERROR( 'test trigger error !', 16, 1)
4
by: Robert Stearns | last post by:
For testing purposes I propose to add a schema (testing, how original) and would like to copy some of my live tables to it, both structure and data. I know I could use something like dump/restore...
2
by: narasingarao | last post by:
Hi to group, I'm a student of M.C.A. from B.I.T. Ranchi...I'm in my project period here i have to migrate the MS-Access database table to Oracle data base tables...so, please help me in getting...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
1
by: AudreyCole | last post by:
Hi. I have an Access front end .mdb file which in connected to Access tables in some locations and to SQL Server tables in others. It also is connected to an Access table for other data, regardless...
3
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
16
mikek12004
by: mikek12004 | last post by:
How to copy a table (with the data) from one server to another (the two servers are in different PCs)? Basically if I could move the data to a txt file inthe form of the insert command (like the...
2
by: kostasgio | last post by:
Hello, this is my first post here, i hope i'll find this forum usefull. Although i did a search about my question, i didnt find what i need , because the question isnt exactly what it sounds. ...
3
by: FKlusmann | last post by:
I have inherited a big, messy table with duplicated data and empty fields consisting of Names (business, client, supplier, etc.), Addresses ( physical, mailing, shipping, billing), Orders ( Date,...
2
by: KMEscherich | last post by:
Hi there, as I am totally new at this, can someone please give me detailed information on how to get Access table or query data to display onto a Dreamweaver page??? Thank you.
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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
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,...
0
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...

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.