2009年10月29日 星期四

Excel openrowset 奇怪的問題

在某台機器上,利用openrowset讀取Excel出現以下錯誤, sql server 2005上surface area configuration的ad hoc remote query也啟用了,但就是不work...
重裝service pack後問題就解決, 但只要重新開機, 問題又來了,而且只有某台機器才會這樣,奇怪奇怪真奇怪...

已获得 OLE DB 记录。源:“Microsoft SQL Native Client” Hresult: 0x80040E14 说明:“无法初始化链接服务器 "(null)" 的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 的数据源对象。”。
已获得 OLE DB 记录。源:“Microsoft SQL Native Client” Hresult: 0x80040E14 说明:“链接服务器"(null)"的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 返回了消息 "未指定的错误"。”。

An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E14 Description: "Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E14 Description: "The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.".

最後找到方法, 設定 registry key,
HKLM\SOFTWARE\Microsoft\Microsoft Sql Server\\Providers\Microsoft.Jet.OLEDB.4.0
AdHocAccess = 0

原文參考 Jet.OLEDB.4.0 and Linked Servers
Check Disallow AdHoc Access, this will create the right key with the wrong value (1 instead of the correct 0). Unchecking this option will remove the key and the value, this is interpreted as 'value = 1'. This 'Removing' in combination with the standard-value 1 (if no key exists) is the bug.
Close the Sql-Management-Studio, open RegEdit and search for the specific key. If you have more than one instance, use the right internal name (MSSQL.1 / MSSQL.2 etc.).
Change the value to 0
Restart your MS-SqlServer. Using Reconfigure doesn't help.


1 則留言:

publish error allowDefinition='MachineToApplication'

一個老舊的aspx web form專案,調了一些功能建置成功,但進行部署時顯示以下錯誤。 在應用程式層級之外使用註冊為 allowDefinition='MachineToApplication' 的區段發生錯誤。錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為...