473,396 Members | 1,866 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,396 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 1125

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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...

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.