Click here to Skip to main content
15,886,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've been trying to connect on the remote data server but keeps giving the same error over and over.

My local server, at running mode, has a green triangle on its icon, means that its running.
My linked server, has a white circle on its icon, I pointed my mouse and right clicked at it but [ Start, Stop, Pause, Resume and Restart ] are disabled.

When i run my program, i connect to my local server, the user then selects from a list in the combo box, from the list the user selects, it will create a connection string, run that string to validate if the connection to the linked server is successful, (which It does as I run and debug that part)..

After the successful connection to the linked server, It will read the Query Statement;
SQL
Select * from [linkedServer].DatabaseName..TableName
or
SQL
Select * from [linkedServer].DatabaseName.dbo.TableName

but still gives this error;
Could not find server 'VMServer' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

i found this and run a test at my local Server and it worked.
SQL
Exec sp_dropserver 'VMSERVER', 'droplogins'
go

EXEC sp_addlinkedserver   
    @server='VMSERVER', 
    @srvproduct='',
    @provider='SQLNCLI', 
    @datasrc='0.0.0.0'

EXEC sp_addlinkedsrvlogin
    @useself='FALSE',
    @rmtsrvname='VMSERVER',
    @rmtuser='sa',
    @rmtpassword='mbwin'
go

but when i run it again with this statement,
SQL
Select Top 10 * from [VMSERVER].PUSAN_KRW_PROD.dbo.GLAC

and the same error appeared.

Am i missing something?
If i can paste a screenshot to give an idea, but don't know how?
Posted
Updated 12-Jan-12 20:08pm
v2

It would seem like a problem with the protocol's used for name resolution.
Sql server can use TCP / IP or Named Pipes provider.
In your case it seems that it uses.

Try to use sp_addlinkedserver with the @ option = 'SQLOLEDB' instead of 'SQLNCLI'
 
Share this answer
 
When you build your connection string you enter the address of your server or the address of linked server?
If you build your connection string with the address of the linked server you have to remove [LinkedServer]. from your query.
 
Share this answer
 
Comments
Alan Tuscano 15-Jan-12 20:39pm    
Hi Spopy,

I have established connection..

in my first code,
VMSERVER.PUSAN_KRW_PROD.dbo.GLAC and got error.
i then made this
[VMSERVER].PUSAN_KRW_PROD.dbo.GLAC and now can make connection.

I will then do workaround here, doing validations, after validating all the requirements, i will insert/copy the records from this remote server [VMSERVER].PUSAN_KRW_PROD.dbo.GLAC; to my local server [DEVELOPER04\MBWIN].mbmis..DlyGlAcc, but is having this error;
Named Pipes Provider: Could not open a connection to SQL Server [1265]?

Here's my code in copying/inserting of records;

strDLY = my local server ([DEVELOPER04\MBWIN].mbmis..DlyGlAcc)
strGL = remote server ([VMSERVER].PUSAN_KRW_PROD.dbo.GLAC)
Conn = is my local connection

strSQL = "Insert Into " & strDLY & " Select * From " & strGL
Dim dx As New SqlDataAdapter(strSQL, conn)
Dim sx As New DataSet
dx.Fill(sx, "rDlyGlacc")

This error appeared;
Named Pipes Provider: Could not open a connection to SQL Server [1265]?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900