We have an OLEDB provider written using C++ and the OLEDB templates. It
works fine under SQL2000 and SQL2005 SP1 but in SP2 we get the following
error
OLE DB provider 'CAMEOProv2.CAMEOProv' cannot be used for distributed
queries because the provider is configured to run in single-threaded
apartment mode.
We can avoid this error by either setting the trace flag 7300 in the startup
parameters or by modifying the registry entry for the provider and changing
the ThreadingModel from Single to Both. However, if we do this then the
provider is unstable and crashes with spurious error messages from time to
time.
Any information on how to get around this problem will be much appreciated,
whether its reconfiguring SQL2005 to support this provider or code changes
within the provider itsself.

Signature
Best regards
Mark
Charles Wang[MSFT] - 19 Feb 2008 03:32 GMT
Hi Mark,
I understand that your OLEDB Provider written in C++ failed working due to
the error that the provider was configured to run in single-threaded
apartment mode. You could work around this issue by setting the trace flag
7300 or by modifying the registry entry, however this makes your provider
unstable and crash with spurious error messages.
If I have misunderstood, please let me know.
This is a known by design limitation caused by the security enhancement in
SQL Server 2005 SP2. The history records regarding this issue in our
internal database indicated that Microsoft is planning to publish a KB for
this. Currently there are two ways that can work around this issue, however
you have mentioned them in your post and they both negatively impact your
provider's stability.
From this article (see threading):
Known Limitations of the OLE DB Provider for ODBC
http://msdn2.microsoft.com/en-us/library/ms719628.aspx
You may change your OLEDB Provider so that it uses free-threaded
multithreading model to see if it helps.
If you have any other questions or concerns, please feel free to let me
know.
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
Charles Wang[MSFT] - 21 Feb 2008 10:58 GMT
Hi Mark,
I am interested in this issue. Would you mind letting me know the result of
the suggestions? If you need further assistance, feel free to let me know.
Have a great day!
Best regards,
Charles Wang
Microsoft Online Community Support
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
Mark Baldwin - 29 Feb 2008 21:12 GMT
Hi Charles,
Thanks for the reply. I am trying to recompile the provider in MTA mode with
VS SP1 but now the provider doesn't work at all. There are numerous issues I
have come across but I won't bother you with them at the moment, if I have
any further queries I will let you know.

Signature
Best regards
Mark Baldwin
> Hi Mark,
>
[quoted text clipped - 16 lines]
> rights.
> ======================================================
Charles Wang[MSFT] - 03 Mar 2008 10:31 GMT
Hi Mark,
Thank you for letting me know the issue status.
We always welcome your posting back if you have any further questions or
concerns. Have a nice day!
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================