天天看点

微软SQL2012无法连接到服务器,sql-server – SQL Server:无法为链接服务器“(null)”初始化OLE DB提供程序“Microsoft.ACE.OLEDB.12.0”的数据...

我试图运行以下查询:

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\Somefile.xlsx','SELECT * FROM [Sheet$]')

但我得到这个错误:

Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

我尝试了以下方法:

sp_configure 'show advanced options',1;

RECONFIGURE;

sp_configure 'Ad Hoc Distributed Queries',1;

RECONFIGURE;

GO

和:

USE [master]

GO

EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0',N'AllowInProcess',1

GO

EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0',N'DynamicParameters',1

GO

当我转到’服务器对象’时 – > ‘链接服务器’ – > ‘Providers’,Microsoft.ACE.OLEDB.12.0已列出.

安装了Acess Database Engine x64,所有Office产品都是64位,我的sql Server也是64位.

如果重要,所有用户都可以访问Users文件夹中的Temp文件夹.

(这些都是我在这个问题的类似答案中找到的建议)

编辑:使用sql Server 2014.