SQL Server not configured for data access

2019-03-23 04:56发布

问题:

I'm running a SQL Server 2005 database from a VB 6 Application. I connect to the database through an 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_dropserver and sp_addserver stored procedures to rename the instance.

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

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 .Update method. I get the following error instead ... SQL Server not configured for data access

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

回答1:

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

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

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


回答2:

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



回答3:

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

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

I need to execute the following:

-- on server A

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

-- on server B

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


回答4:

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.



回答5:

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

Works on SQL Server 2014.

Regards



回答6:

with this use master

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

go

linked servers genereated for replication still showing same error