简体   繁体   中英

Linked server “Data source name not found and no default driver specified” error

I made a linked server with Microsoft OLE DB Provider for ODBC Drivers:

EXEC master.dbo.sp_addlinkedserver @server = N'TEST', 
                                @srvproduct=N'Microsoft Visual FoxPro Driver', 
                                @provider=N'MSDASQL', 
                                @datasrc=N'TEST'


It worked fine still I used WIndows Authentication Mode, but when I created a login user and switch to SQL AUthentication it did not work.
What changes are needed to work with SQL Authentication?
In providers I have enabled:"Nested queries","Allow inpocess", Level zero only".
The error is:

OLE DB provider "MSDASQL" for linked server "TEST" returned message "[Microsoft][ODBC Driver Manager] Invalid connection string attribute". OLE DB provider "MSDASQL" for linked server "TEST" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "TEST".

This error message can occur because of one of these problems.

  • One of the initialization parameters specified in sp_addlinkedserver ( data_source, location, provider_string, or catalog ) is incorrect for this provider.

    Verify that these parameters defined for the linked server, specified by executing
    sp_addlinkedserver , are correct for the given provider.

    Check Here also sp_addlinkedsrvlogin

  • Login and password sent to the provider is invalid.

    Verify that there is a valid login and password configured for the linked server and the current SQL Server login through sp_addlinkedsrvlogin .

Go through this Article

UPDATE

During a linked server connection (for example, when it processes a distributed query), the sending server provides a login name and password to connect to the receiving server on its behalf. For this connection to work, you must create a login mapping between the linked servers by using SQL Server system stored procedures. -- HERE and HERE

You need to create login mapping for linked server see security for Linked Server

Use sp_addlinkedsrvlogin

Creates or updates a mapping between a login on the local instance of SQL Server and a security account on a remote server.

sp_addlinkedsrvlogin [ @rmtsrvname= ] 'rmtsrvname' 
     [ , [ @useself= ] 'TRUE' | 'FALSE' | 'NULL'] 
     [ , [ @locallogin= ] 'locallogin' ] 
     [ , [ @rmtuser= ] 'rmtuser' ] 
     [ , [ @rmtpassword= ] 'rmtpassword' ] 

If the connection to the linked server works fine using Windows Authentication, but it doesn't using a SQL Server Authentication, I would have a look at the properties of the linked server and make sure, choosing the tab "Security", that both the authentication modes are enabled:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM