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

做~自己de王妃 提交于 2019-11-29 15:17:55

问题


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]')

回答1:


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

c:>AccessDatabaseEngine_64 /passive




回答2:


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




回答3:


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.




回答4:


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




回答5:


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.




回答6:


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$]');
    


来源:https://stackoverflow.com/questions/2899201/microsoft-ace-oledb-12-0-64x-sql-server-and-86x-office

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!