未针对数据访问配置 SQL Server

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/629677/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 01:22:25  来源:igfitidea点击:

SQL Server not configured for data access

sqlsql-servertsqlvb6

提问by gbn

I'm running a SQL Server 2005 database from a VB 6 Application. I connect to the database through an ODBC DSN.

我正在从 VB 6 应用程序运行 SQL Server 2005 数据库。我通过 ODBC DSN 连接到数据库。

I renamed the computer on which I'm running the default instance of SQL server from 'Software' to 'IT'. I then ran the sp_dropserverand sp_addserverstored procedures to rename the instance.

我将运行 SQL 服务器默认实例的计算机从“软件”重命名为“IT”。然后我运行sp_dropserversp_addserver存储过程来重命名实例。

On restarting the SQL Server service, the server was able to pick up on the new SQL Server name.

在重新启动 SQL Server 服务时,服务器能够使用新的 SQL Server 名称。

After configuring the ODBC data source name to the new name, the connection was Ok. I'm able to run my application and read records through ADO record sets. However I'm unable to update any recordset using the .Updatemethod. I get the following error instead ... SQL Server not configured for data access

将 ODBC 数据源名称配置为新名称后,连接正常。我能够运行我的应用程序并通过 ADO 记录集读取记录。但是我无法使用该.Update方法更新任何记录集。我收到以下错误...SQL Server not configured for data access

How can I enable data access on the renamed server instance?

如何在重命名的服务器实例上启用数据访问?

回答by gbn

How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server 2005

如何:重命名承载 SQL Server 2005 独立实例的计算机

You should be able to run this but notagainst any linked server. It's not a linked server. It's local.

您应该能够运行它,但不能针对任何链接服务器。它不是链接服务器。这是本地的。

EXEC sp_serveroption 'YourServer', 'DATA ACCESS', TRUE

回答by Ljuba Buinjac

Just go to the linked server properties > Server options > Data access --> true

只需转到链接服务器属性 > 服务器选项 > 数据访问 --> true

Works on SQL Server 2014.

适用于 SQL Server 2014。

Regards

问候

回答by Piotr Rodak

This post is quite old, but maybe someone will come across it. I wrote an blog postabout this option, it can be set on local and linked servers.

这篇文章很老了,但也许有人会遇到它。我写了一篇关于这个选项的博客文章,它可以在本地和链接的服务器上设置。

回答by Marcello Miorelli

I just would like to add to the previous answers that, at least in my case here, I needed to enable data access in both places.

我只想补充之前的答案,至少在我这里的情况下,我需要在两个地方都启用数据访问。

for instance:

例如:

there is server A and server B

有服务器 A 和服务器 B

On server A I have a linked server LB that links me from server A to server B

在服务器 A 上,我有一个链接服务器 LB,它将我从服务器 A 链接到服务器 B

I need to execute the following:

我需要执行以下操作:

-- on server A

-- 在服务器 A

exec sp_serveroption 'LB', 'data access', 'true'

-- on server B

-- 在服务器 B

exec sp_serveroption 'B', 'data access', 'true'

回答by Neil P

I've just come across this error and found that it was caused by me trying to run OpenQuery against the local server (doh!). Changing the server name to that of an actual linked server resolved my issue.

我刚刚遇到这个错误,发现它是由我试图对本地服务器运行 OpenQuery 引起的(doh!)。将服务器名称更改为实际链接服务器的名称解决了我的问题。

回答by user2991005

with this use master

有了这个使用大师

exec sp_serveroption 'server name', 'data access', 'true'

go 

linked servers generated for replication still showing same error

为复制生成的链接服务器仍然显示相同的错误