不能连接远程数据库
連接sql時提示以下內(nèi)容
SQL Server 阻止了對組件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的訪問,因為此組件已作為此服務(wù)器安全配置的一部分而被關(guān)閉。系統(tǒng)管理員可以通過使用 sp_configure 啟用 'Ad Hoc Distributed Queries'。有關(guān)啟用 'Ad Hoc Distributed Queries' 的詳細(xì)信息,請參閱 SQL Server 聯(lián)機(jī)叢書中的 "外圍應(yīng)用配置器"。
??? 看錯誤提示就知道是因為SQL Server的Ad Hoc Distributed Queries組件被禁用了,這里我用的SQL Server版本是2005,只需要開啟Ad Hoc Distributed Queries就可以了,方法如下:
??? 1.開啟Ad Hoc Distributed Queries組件,在sql查詢編輯器中執(zhí)行如下語句:
?
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
??? 2.關(guān)閉Ad Hoc Distributed Queries組件,在sql查詢編輯器中執(zhí)行如下語句:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
轉(zhuǎn)載于:https://blog.51cto.com/bks2015/1606524
總結(jié)
- 上一篇: JVM参数详解和调优
- 下一篇: SQL SERVER中的纵横查询