Update in Sybase 11 Linked Server problem

When trying to update records in a Sybase 11 ODBC linked server got this error:

Server: Msg 7330, Level 16, State 2, Line 1
Could not fetch a row from OLE DB provider 'MSDASQL'.
OLE DB error trace [OLE/DB Provider 'MSDASQL' IRowset::GetNextRows returned 0x8001010e].

[377 byte] By [DDT] at [2008-1-25]
# 1
Hi,

0x8001010e is the code for RPC_E_WRONG_THREAD, which has the text: "The application called an interface that was marshalled for a different thread."

I've asked around and this might be provider implementation bug. I got the following suggestion:

"This should be a problem with the intercontext use of an interface. I do not think MSDASQL has a problem itself.

So the problem might be in a way MSDASQL object and also if the ADO’s cursor engine is involved then its objects are getting created by SQL server.

<You> should check the apartment model for MSDASQL and ADO objects as a first step."

I'm not familiar with any of these, so I can't provide more info, but I'll try and find out more if this doesn't help.

Thanks
Laurentiu

LaurentiuCristofor at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Security...
# 2
Hi, thanks, I found that Sybase ODBC driver has an option to indicate that applications can have multiple threads.
I changed this option (turn it on) and now I got the following error when I try to update a row in the linked server in SQL Query Analyzer using a single UPDATE statement.

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.
[OLE/DB provider returned message: Unspecified error]
[OLE/DB provider returned message: Transaction cannot have multiple recordsets with this cursor type. Change the cursor type, commit the transaction, or close one of the recordsets.]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IRowset::GetNextRows returned 0x80004005: ].

DDT at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Security...
# 3
I got the following info on this:

"It looks similar to the situation in RFC 1839.

From the information in the RFC, it seems that it can have something to do with the automatic transaction enlistment. <You> could try and see if disabling autoenlistment solves the problem."

Here, RFC1839 refers to a WebData QFE. Let me know if this helps.

Thanks
Laurentiu

LaurentiuCristofor at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Security...
# 4
Thanks for your time.
I found that I cannot update rows in Sybase but I can insert new rows. So I′m now inserting rows in a temporary table, this new temp table has a trigger that updates the original table with the inserted data. It is working fine by now.
We are migrating the conflict database from Sybase to SQL Server, and in a short time we are removing this function, so we decide not to spend more time with this.
DDT at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Security...

SQL Server

Site Classified