【发布时间】:2019-06-13 15:13:33
【问题描述】:
我要告诉你我的环境:Windows Server 2012 R2 64、ACCESS 2010 32、SQL SERVER 2008 R2 64 使用管理员帐户运行,AccessDatabaseEngine 32。我需要将 sql 连接到 2010 的 bbdd 访问。我尝试创建一个链接服务器并使用 OPENDATASOURCE 和 OPENROWSET 但总是出现错误
OLE DB 提供程序“Microsoft.ACE.OLEDB.12.0”不能用于 分布式查询,因为它被配置为以简单的方式运行 受控线程模式。
我一直在互联网上搜索,我按照所有步骤操作,但我仍然有同样的错误,我也使用管理员和 sa 帐户的 SSMS,但总是同样的错误。奇怪的是,安装 AccessDatabaseEngine 32 后,“Microsoft.ACE.OLEDB”并没有出现在 Server Objects 的提供程序中。
非常感谢和问候。
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
exec sp_configure 'Advanced', 1
RECONFIGURE
GO
exec sp_configure 'Ad Hoc Distributed Queries', 1
RECONFIGURE
GO
exec sp_configure 'xp_cmdshell', 1
RECONFIGURE
GO
sp_configure 'show advanced options', 1
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
EXEC sp_addlinkedserver
@server = N'DATOS',
@provider = N'Microsoft.ACE.OLEDB.12.0',
@srvproduct = N'OLE DB Provider for ACE',
@datasrc = N'C:\SERVIDOR\DATOS\BBDDs.accdb';
GO
SELECT id From OpenRowset('Microsoft.ACE.OLEDB.12.0',';Database=C:\SERVIDOR\DATOS\BBDDs.accdb;','SELECT * from Productos') as B
GO
SELECT * FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0','Data Source=C:\SERVIDOR\DATOS\BBDDs.accdb')...Productos
GO
【问题讨论】:
标签: sql-server tsql ms-access