473,413 Members | 1,799 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,413 software developers and data experts.

Using Transactions to Insert Data to Db2 Database

Hi All

I am trying to insert data within a transaction, into a Db2 database
from asp.net.

I have created a System DSN using ISeries Access Driver(32 bit) for
Windows. I am then connecting to it using Microsoft .Net data provider
from asp.net.

I am able to insert data by using connection and comand object without
the transaction.

But the PROBLEM comes when i try to put the INSERT query execution
within a Transaction.
Like the following
cnOdbc = New OdbcConnection("DSN=TEST;UID=ABCD;PWD=1234")
cnOdbc.Open()
cmdOdbc.Connection = cnOdbc
tranODBC = cnOdbc.BeginTransaction(IsolationLevel.ReadCommitt ed)
cmdOdbc.Transaction = tranODBC
TRY
strSql = "Insert INTO LIBRARYNAME.TABLENAME
VALUES('Z','6789','TAPSING')"
cmdOdbc.CommandText = strSql
cmdOdbc.ExecuteNonQuery() ''ERROR OCCURS ON THIS LINE''
tranODBC.Commit
Catch ex as Exception
tranODBC.RollBack
Finally
tranODBC.close

ERROR returned is
"ERROR [HY000] [IBM][iSeries Access ODBC Driver][DB2 UDB]SQL7008 -
<TableName> in <LibraryName> not valid for operation."

I will highly appreciate any help on the issue.

Vaibhav
Nov 12 '05 #1
0 3967

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

Similar topics

0
by: Walt | last post by:
I'm running SQL Server 2000 SP2 transactional replication. Periodically replication fails due to primary key errors. On investigation I find that the offending transaction is attempting to insert...
2
by: Iain | last post by:
Hi I have the following tables and stored procedure. I need to pass a value to the stored procedure and have it use the value in a query. After running that query it will return an ID which is...
4
by: marc | last post by:
I've been developing a stored procedure that uses a user defined function in the query portion of the procedure. However, since the end product needs to allow for dynamic table names, the UDF will...
1
by: Azel | last post by:
Hi, I am trying to learn ADO.net and I keep running into problems trying to insert data into my Access Database: data.mdb. here is my code: <code> // Database Variables
11
by: Chris Fink | last post by:
I have setup an Oracle table which contains a blob field. How do I insert data into this field using C# and ADO.net?
2
by: Sridhar | last post by:
Hi, I am trying to implement sql transactions. But I am not knowing how to do that. I created a data access layer which contains methods to select/insert/update tables in a database. I have also...
12
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql...
4
by: eeb4u | last post by:
I am connecting to MS SQL 2000 from Red Hat EL4 using freetds and currently running queries to get counts on tables etc. When running SELECT queries I notice that the data returns and I have to...
0
by: David | last post by:
- Are there any peculiarities with using curs.executemany(...) vs. multiple How many times are you calling execute vs a single executemany? The python call overhead will add up for thousands of...
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: 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
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...
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
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
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...

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.