Sql “OLE DB提供程序”;Microsoft.ACE.OLEDB.12.0“;“用于链接服务器”;(无效)“;

Sql “OLE DB提供程序”;Microsoft.ACE.OLEDB.12.0“;“用于链接服务器”;(无效)“;,sql,visual-studio-2013,openrowset,Sql,Visual Studio 2013,Openrowset,我试图运行下面的语句,但收到下面的错误消息。我对答案进行了无休止的研究,没有一个对我有用。我正在运行Office 365(64位)。我已加载Microsoft Access数据库引擎(64位)。这是在Visual Studio 2013中使用SSDT和SQL Server 2012实现的。我无权更改SQL Server的环境或启动参数。感谢您的帮助 SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.15.0', 'Excel 12.0;Data

我试图运行下面的语句,但收到下面的错误消息。我对答案进行了无休止的研究,没有一个对我有用。我正在运行Office 365(64位)。我已加载Microsoft Access数据库引擎(64位)。这是在Visual Studio 2013中使用SSDT和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$])
  • Msg 7399,级别16,状态1,第1行OLE DB提供程序 “用于链接服务器的Microsoft.ACE.OLEDB.15.0”(null)报告了 错误。提供程序没有提供有关错误的任何信息
  • Msg 7303,16级,状态1,第1行无法初始化数据源 链接的OLE DB提供程序“Microsoft.ACE.OLEDB.15.0”的对象 服务器“(空)”
以下是我尝试过的:

首先,我跑

sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
然后是…没有爱

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 
EXEC sys.sp_addsrvrolemember@loginame=N',@rolename=N'sysadmin';
去
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.oledb.15.0',N'AllowInProcess',1
去
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.oledb.15.0',N'DynamicParameters',1
去
我已经将代码改为Microsoft.ACE.OLEDB.12.0,正如我所看到的,仍然没有爱

我还检查了C:\Users\MSSQLSERVER\AppData\Local\Temp和C:Windows\ServiceProfiles\NetworkService\AppData\Local的权限,这些权限已授予以下各项的完全控制权:系统、MSSQLSERVER和管理员、网络服务(在后者上)

还是没有爱

最后,我试着换成32位版本的MicrosoftAccess数据库引擎,它一直不工作


有人需要帮助吗?

在我们的例子中,它帮助为SQL Server服务添加了一个参数:

  • 转到
    Services.msc
    ,选择SQL Server服务 和开放属性
  • 选择
    启动参数
    并添加新参数 参数
    –g512
  • 重新启动SQL server服务
  • 这就解决了问题。
    由于某些原因,SQL Server不喜欢默认的MSSQLSERVER帐户。将其切换到本地用户帐户可以解决此问题。

    在SQL Server中,请尝试以下步骤:

  • 打开一个数据库
  • 单击选项
    服务器对象
  • 单击链接的服务器
  • 单击
    提供程序
  • 右键单击
    Microsoft.ACE.OLEDB.12.0
    ,然后单击
    Properties
  • 取消选中所有选项并关闭

  • 确保Excel文件未打开

  • 关闭SQLServerManagementStudio。在run命令中键入Services.msc以打开服务窗口

  • 搜索SQL Server服务,右键单击它并选择属性

  • 在“登录”选项卡中,选择系统帐户/或选择您的域ID、帐户和密码

  • 找到您的登录名后,按OK

  • 现在在这两个字段中键入您的登录密码

  • 重新启动服务,以便应用新的更改,如下图所示

  • 现在启动SQLServerManagementStudio并尝试运行查询,如果仍然无法运行,请尝试重新启动系统

  • 。。。或执行以下查询:

    使用[master]
    去
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.oledb.12.0',N'AllowInProcess',1
    去
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.oledb.12.0',N'DynamicParameters',1
    去
    
    我没有改变用户,而是发现以下建议:

    这可能会帮助其他人摆脱困境——在尝试了所有解决方案之后 正在尝试并修复SQL 64上的此错误

    无法初始化OLE DB提供程序的数据源对象 “Microsoft.ACE.OLEDB.12.0”用于链接服务器(空)”

    …我在这里找到一篇文章

    …建议我给每个人这个文件夹的完全权限

    C:\Users\SQL服务帐户名\AppData\Local\Temp

    嘿,普雷斯托!我的疑问突然变得生动起来。我向空中猛击 高兴地

    埃德瓦尔多


    这是我的参考,因为我在尝试连接提供程序时遇到了各种SQL错误消息。其他答案规定“试试这个,然后这个,然后这个”。我很欣赏其他答案,但我喜欢将具体的解决方案与具体的问题结合起来


    错误

    …提供程序未提供信息…无法初始化数据源对象

    错误编号

    73997303

    错误详细信息

    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)".
    
    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)".
    
    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)". 
    
    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)".
    
    解决方案

    文件已打开。关上它

    信用


    错误

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

    错误编号

    7399,7350

    错误详细信息

    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)".
    
    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)".
    
    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)". 
    
    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)".
    
    解决方案

    准许进入

    信用


    错误

    没有为一个或多个必需参数指定值…无法执行查询

    错误编号

    ,7320

    错误详细信息

    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)".
    
    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)".
    
    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)". 
    
    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)".
    
    解决方案

    列名可能是错误的。您的电子表格中是否确实存在
    [Col A]
    [Col B]


    错误

    “未指定错误”…无法初始化数据源对象

    错误编号

    ,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)".
    
    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)".
    
    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)". 
    
    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)".
    
    解决方案

    以管理员身份运行SSMS。看


    其他参考资料

    建议修改属性的其他答案。不确定如何修改这两个属性(检查或取消选中