OLE DB提供程序"Microsoft.ACE.OLEDB.12.0"用于链接服务器"(null)"

Ste*_*erg 32 sql openrowset visual-studio-2013

我正在尝试运行以下语句,但正在接收下面的错误消息.我已经研究过没有尽头的答案,没有一个对我有用.我正在运行Office 365(64位).我已加载Microsoft Access数据库引擎(64位).这是在带有SSDT的Visual Studio 2013以及SQL Server 2012中.我无权访问更改环境或启动参数到SQL Server.任何帮助表示赞赏.

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.15.0', 
    'Excel 12.0;Database=C:\Users\UserName\Folder\SomeFile.xlsx;;HDR=NO;IMEX=1', [Table 1$])
Run Code Online (Sandbox Code Playgroud)
  • 消息7399,级别16,状态1,行1 OLE DB提供程序"Microsoft.ACE.OLEDB.15.0"用于链接服务器"(null)"报告错误.提供商未提供有关错误的任何信息.
  • 消息7303,级别16,状态1,行1无法为链接服务器"(null)"初始化OLE DB提供程序"Microsoft.ACE.OLEDB.15.0"的数据源对象.

这是我尝试过的:

首先,我跑了......

sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
Run Code Online (Sandbox Code Playgroud)

紧随其后......没有爱情.

EXEC sys.sp_addsrvrolemember @loginame = N'<<Domain\User>>', @rolename = N'sysadmin';
GO

EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.15.0', N'AllowInProcess', 1 
GO 
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.15.0', N'DynamicParameters', 1 
GO 
Run Code Online (Sandbox Code Playgroud)

我已经将代码更改为阅读Microsoft.ACE.OLEDB.12.0,因为我已经看到了,仍然没有爱.

我还检查了C:\ Users\MSSQLSERVER\AppData\Local\Temp和C:Windows\ServiceProfiles\NetworkService\AppData\Local的权限,这些权限已授予对以下内容的完全控制权:System,MSSQLSERVER和Administrators,Network Service(on后者).

仍然没有爱.

最后,我尝试更改为32位版本的Microsoft Access数据库引擎,该版本一直无法正常工作.

帮忙,有人吗?

小智 19

http://www.aspsnippets.com/Articles/The-OLE-DB-provider-Microsoft.Ace.OLEDB.12.0-for-linked-server-null.aspx

这解决了这个问题.出于某种原因,SQL Server不喜欢默认的MSSQLSERVER帐户.将其切换到本地用户帐户可解决此问题.

  • 您应该在答案中添加相关代码,而不是简单地共享链接. (20认同)

Mic*_*rup 19

我没有改变用户,而是找到了这样的建议:

https://social.technet.microsoft.com/Forums/lync/en-US/bb2dc720-f8f9-4b93-b5d1-cfb4f8a8b1cb/the-ole-db-provider-microsoftaceoledb120-for-linked-server-null-reported-一个错误的访问?论坛= sqldataaccess

这可能有助于其他人 - 在尝试每个解决方案后尝试并在SQL 64上修复此错误.

无法为链接服务器"(null)"初始化OLE DB提供程序"Microsoft.ACE.OLEDB.12.0"的数据源对象.

..我在这里发现了一篇文章......

http://sqlserverpedia.com/blog/sql-server-bloggers/too-many-bits/

..谁建议我给每个人完全许可这个文件夹..

C:\ Users\SQL Service帐户名\ AppData\Local\Temp

嘿presto!我的疑问突然爆发了.我高兴地打了一拳.

Edwaldo


The*_*Pea 17

这是我的参考,因为我在尝试与提供程序连接时遇到了各种SQL错误消息.其他答案规定"试试这个,然后这个,然后这个".我很欣赏其他答案,但我喜欢将特定解决方案与特定问题配对


错误

...提供者没有提供信息......无法初始化数据源对象...

错误号码

7399,7303

错误细节

Msg 7399, Level 16, State 1, Line 2 The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. 
  The provider did not give any information about the error. 
Msg 7303, Level 16, State 1, Line 2 Cannot initialize the data source object
  of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
Run Code Online (Sandbox Code Playgroud)

文件已打开.关闭它.

信用


错误

访问被拒绝...无法获取列信息...

错误号码

7399,73 50

错误细节

Msg 7399, Level 16, State 1, Line 2 The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. 
  Access denied.
Msg 7350, Level 16, State 2, Line 2 Cannot get the column information 
  from OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
Run Code Online (Sandbox Code Playgroud)

提供访问权限

信用


错误

没有给出一个或多个必需参数的值....无法执行查询...

错误号码

??? ,73 20

错误细节

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "No value given for one or more required parameters.".
Msg 7320, Level 16, State 2, Line 2
Cannot execute the query "select [Col A], [Col A] FROM?$Sheet" against OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)". 
Run Code Online (Sandbox Code Playgroud)

列名可能有误.做[Col A][Col B]在电子表格中实际上存在吗?


错误

"未指定的错误"...无法初始化数据源对象...

错误号码

??? ,7303

错误细节

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Line 2 Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
Run Code Online (Sandbox Code Playgroud)

以管理员身份运行SSMS.看到这个问题.


其他参考文献

其他建议修改属性的答案.不确定如何修改这两个属性(检查它们或取消选中它们)会有所帮助.


小智 15

确保Excel文件未打开.