Microsoft KB Archive/196292

= PRB: Installing DA SDK Causes SQL Distributed Queries to Fail =

Article ID: 196292

Article Last Modified on 3/2/2005

-

APPLIES TO


 * Microsoft Data Access Components Software Development Kit 2.0
 * Microsoft Data Access Components Software Development Kit 2.1
 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft Data Access Components 2.0
 * Microsoft Data Access Components 2.1

-



This article was previously published under Q196292



SYMPTOMS
After installing the Microsoft Data Access 2.0 SDK, the following errors may occur when trying to perform a SQL Server 7.0 distributed query:

Server: Msg 7302, Level 16, State 1 Could not create an instance of OLE DB provider ''

-or-

Server: Msg 7373, Level 16, State 2

Could not set the initialization properties for the OLE DB Provider ''.

-or-

ODBC: Msg 0, Level 19, State 1

SqlDumpExceptionHandler: Process 7 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.



CAUSE
Microsoft SQL Server installs a proxy/stub DLL for the OLE DB interfaces called Msdaps.dll. This is used to marshal OLE DB interfaces between processes/apartments. If the OLE DB Provider is invoked out of process or is marked as apartment model, this proxy-stub DLL gets used. By default, if the OLE DB provider is a known Microsoft provider, SQL Server 7.0 will invoke the OLE DB provider in-process and the problem mentioned in this article will not occur. If the provider is third party, it will be invoked out-of-process.

When installing the Microsoft Data Access SDK, a different proxy/stub DLL gets registered for use of ITestSpy. The file is called Oledbproxy.dll. This replaces the Msdaps.dll proxy-stub DLL and causes OLE DB providers to fail when invoked out of process or marked as apartment model.



RESOLUTION
To get SQL Server 7.0 distributed queries to work when the OLE DB Provider is invoked out of process or is marked as apartment model, re-register the Msdaps.dll located in the "\Program Files\Common Files\System\ole db" folder using Regsvr32.exe.



MORE INFORMATION
Microsoft SQL Server version 7.0 provides the ability to perform queries against OLE DB providers. This is done by using the OpenQuery or OpenRowset Transact-SQL functions or by using a query with four-part names including a linked-server name. For example,

sp_addlinkedserver 'mylinkedserver', 'product_name', 'myoledbprovider', 'data_source','location', 'provider_string', 'catalog'

SELECT * FROM OPENQUERY(mylinkedserver, 'select * from table1')

The SELECT statement will perform the SQL statement against the OLE DB Provider.

