我想执行简单的语句:
SELECT * FROM
OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Text;Database=C:\Temp\;','SELECT * FROM [test.csv]')
今天早上我突然收到这条消息:
Msg 7308, Level 16, State 1, Line 1
OLE DB provider 'MICROSOFT.JET.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.
它一直工作到今天早上!
这是我的服务器规格:Windows 2008 R2 64 位 SQL Server 2008 64 位
我已经安装了 AccessDatabaseEngine_x64.exe。
Sql Server 在 LocalService 帐户下运行。我已将每个人都设置为对“C:\Temp”和“C:\Windows\ServiceProfiles\LocalService\AppData\Local”拥有完全控制权限。
有什么我错过的吗?我真的很困惑...
编辑:我还执行了这些语句:
sp_configure ‘show advanced options’, 1;
GO
RECONFIGURE;
GO
sp_configure ‘Ad Hoc Distributed Queries’, 1;
GO
RECONFIGURE;
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
我还ACE.OLEDB.12.0
使用管理员帐户进行了测试:
SELECT * FROM
OPENROWSET('MICROSOFT.ACE.OLEDB.12.0','Text;Database=C:\Temp\;','SELECT * FROM [test.csv]')
还有一个错误:
OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)".
最后我找到了:我运行了 ProcMon,看到 Sql Server 想要访问 F:\Windows Temp\ 并且该文件夹不存在!我创建了文件夹,问题就解决了。但是,我从来没有这样的文件夹!