开发者

'Microsoft.ACE.OLEDB.12.0' 64x Sql Server and 86x Office?

开发者 https://www.devze.com 2022-12-31 05:40 出处:网络
The error: OLE DB provider \'Microsoft.ACE.OLEDB.12.0\' cannot be used for distributed开发者_开发百科 queries because the provider is configured to run in single-threaded apartment mode.

The error:

OLE DB provider 'Microsoft.ACE.OLEDB.12.0' cannot be used for distributed开发者_开发百科 queries because the provider is configured to run in single-threaded apartment mode.

And the answers I'm seeing is a conflict between 64 bit Sql Server and 32 bit Office. Is there a way to run an openrowset on Excel into Sql Server?

insert into dbo.FiscalCalendar 
select * from 
openrowset('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml;Database=C:\Users\uname\Desktop\fy11.xlsx;',
'Select * from [Sheet1]')


...the key is to install the 64-bit Access engine using the /passive flag:

c:>AccessDatabaseEngine_64 /passive


Looks like Microsoft hasn't come up with a solution on this yet. check Microsoft feedback form of products

They have some workarounds like using SSIS


You have to install the Microsoft Access Database Engine 2010 Redistributable 64-bit first, which you can download from here.

Assume that your Excel file is: E:\Sample.xls and your Excel sheet name is: Sheet1

Run the following to get the data from Excel file:

SELECT * FROM OPENDATASOURCE( 'Microsoft.ACE.OLEDB.12.0', 'Data Source="E:\Sample.xls";
Extended properties=Excel 8.0')...Sheet1$

The above query is running on Windows Server 2008 64-bit with SQL Server 2005 64-bit and SQL Server 2008 R2 64-bit installed.

The key is to specify the 64-bit provider 'Microsoft.ACE.OLEDB.12.0' instead of 32-bit only Jet engine.


I've run into this same exact issue and the only thing I could ever do were an SSIS data source component where you can consume it as part of a workflow


I installed the Microsoft Access Database Engine 2010 Redistributable 64-bit with no success. I am running W7 64bit, Office 2010 and SQL 2008 R2.

The import/Export wizard prepares the package, but when I choose to save the package, and execute it, it executes just fine. It is when I open the package on a MS VS 2008 that it gave me the error. Installing the Access Database Engine 2010 did not solve the problem. I tried the 2007 and it worked.

Go figures.


Situation: MS Office 2010 (x86/32bit) on a Windows 7 (x64/64bit) with SQL Server 2014 (x64/64bit) installed

Our solution:

  1. Stop SQL Server if running and close any opened MS Office programs

  2. Download MS Access Database Engine 2010 Redistributable as x64/64-bit version: https://www.microsoft.com/de-de/download/details.aspx?id=13255

  3. Open windows command shell (Start-Execute-"cmd") with administrator rights and execute downloaded setup file as follows: AccessDatabaseEngine_X64.exe /passive

  4. Start regedit and go to the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Common\FilesPath. Rename the value mso.dll into mso.dll.rename

  5. We also needed to grant full rights to everyone for the folder, where the XLSX files were stored we wanted to import (don't do this on multi-user machines or on shared folders).

  6. Open windows system control. Go to administrative tools, services and open the properties of MS SQL Server service. Under "Log On" select "local system account". Save and restart MS SQL Server.

  7. Open SQL Server Management Studio, connect to your MS SQL Server instance and run the following T-SQL statement:

    EXEC sp_configure 'show advanced options', 1
    RECONFIGURE
    GO
    EXEC sp_configure 'ad hoc distributed queries', 1
    RECONFIGURE
    GO
    EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
    GO
    EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
    GO
    
  8. Check with following T-SQL statement:

    SELECT * FROM OPENROWSET( 'Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;HDR=YES;Database=C:\YourFolder\File.xlsx', 'SELECT * FROM [Sheet1$]');
    
0

精彩评论

暂无评论...
验证码 换一张
取 消