Unix Technical Forum

Using Transactions to Insert Data to Db2 Database

This is a discussion on Using Transactions to Insert Data to Db2 Database within the DB2 forums, part of the Database Server Software category; --> Hi All I am trying to insert data within a transaction, into a Db2 database from asp.net. I have ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 01:30 AM
Dinu
 
Posts: n/a
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:13 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com