解决无法初始化OLE DB提供程序"Microsoft.ACE.OLEDB.12.0&"的数据源对象.对于链接服务器“任何名称" [英] Solving Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "any name"
问题描述
当我直接在sql server 2012中执行以下行时,一切正常,我从sql server中的excel文件中获取所有记录.但是,当我从Web表单运行相同的查询时,却出现异常
查询:-
When i execute below lines directly in sql server 2012 everything works fine and i get all the records from excel file in sql server. But when i run the same queries from my web form i m getting an exception
queries:-
EXEC sp_addlinkedserver
@server = 'abc',
@srvproduct = 'Excel',
@provider = 'Microsoft.ACE.OLEDB.12.0',
@datasrc = 'E:\abc\July-14.xlsx',
@provstr = 'Excel 12.0;IMEX=1;HDR=YES';
SELECT * FROM OPENQUERY(abc, 'SELECT * FROM [Sheet1$]')
例外:-
Exception:-
{System.Data.SqlClient.SqlException(0x80131904):链接服务器的OLE DB提供程序"Microsoft.ACE.OLEDB.12.0" "abc"报告了一个错误.身份验证失败.
无法为链接服务器"abc"初始化OLE DB访问接口提供程序"Microsoft.ACE.OLEDB.12.0"的数据源对象.}
{System.Data.SqlClient.SqlException (0x80131904): The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "abc" reported an error. Authentication failed.
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "abc".}
为什么?帮帮我...
在此先感谢...
Why so?Help Me Out...
Thanks in advance...
推荐答案
')
例外:-
Exception:-
{System.Data.SqlClient.SqlException(0x80131904):链接服务器的OLE DB提供程序"Microsoft.ACE.OLEDB.12.0" "abc"报告了一个错误.身份验证失败.
无法为链接服务器"abc"初始化OLE DB访问接口提供程序"Microsoft.ACE.OLEDB.12.0"的数据源对象.}
{System.Data.SqlClient.SqlException (0x80131904): The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "abc" reported an error. Authentication failed.
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "abc".}
为什么?帮帮我...
预先感谢...
Why so?Help Me Out...
Thanks in advance...
请检查此链接:
[ sql-server-import -data-from-excel-using-t-sql [
Please check this link :
OLE DB provider "MICROSOFT.JET.OLEDB.4.0" for linked server "(null)" returned message "Unspecified error".[^]
Or
sql-server-import-data-from-excel-using-t-sql[^]
Good luck.
尝试一下:
try this:
sp_configure 'show advanced options', 1;
RECONFIGURE;
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
https://msdn.microsoft.com/en-US/Library/ms187569.aspx [ ^ ]
https://msdn.microsoft.com/en-US/Library/ms187569.aspx[^]
这篇关于解决无法初始化OLE DB提供程序"Microsoft.ACE.OLEDB.12.0&"的数据源对象.对于链接服务器“任何名称"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!