[sql異常]SQL Server 阻止了對組件 'Ad Hoc Distributed Queries' 的

//執行遠程數據庫表查詢

SELECT * FROM OPENDATASOURCE('SQLOLEDB',

                               'Data Source=數據庫地址;User ID=sa;password=sa'

                               ).northwind.dbo.title

 

出現異常:

 

 

消息 15281,級別 16,狀態 1,第 1 行
SQL Server 阻止了對組件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的訪問,因爲此組件已作爲此服務器安全配置的一部分而被關閉。系統管理員可以通過使用 sp_configure 啓用 'Ad Hoc Distributed Queries'。有關啓用 'Ad Hoc Distributed Queries' 的詳細信息,請參閱 SQL Server 聯機叢書中的 "外圍應用配置器"。


利用沙盒模式失敗時需要用到,解決方法:
啓用Ad Hoc Distributed Queries:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

 

關閉Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

 

 

原文地址:http://hi.baidu.com/cive/blog/item/d818c63faf8036c57d1e71cf.html  [一個程序員的小屋]

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章