Thursday 16 July 2015

SQL Server: How to use NamedPipe Protocol to establish connection

Error:-

 (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 1326)

To resolve this issue , we can create alias on client server using TCP/IP protocol.

But story was different here, There was a situation when an application was unable/couldn't establish connection using TCP/IP protocol. 

As a solution , I was bound to use NamedPipe protocol.

Steps to use NamedPipe protocol:-

1. Enable the NamedPipe protocol on Database server

Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> Select NamedPipe

Right Click on NamedPipe>> Click on Enable

2. For clustered instance named S12345\SQL1 , here is is pipe name

\\.\pipe\$$\S12345\MSSQL$SQL1\sql\query

S12345 -- It is virtual SQL Server name 
SQL1 -- Instance name

3. You must restart SQL Server Services for all the changes to take effect.

4. Enable the NamedPipe protocol on Client server

5. Create Alias on Client server/Client Machine

Create 32 bit alias with following mentioned parameters

a. Alias name : S12345\SQL1
b. Pipe Name : \\S12345.ca.com\pipe\$$\S12345\MSSQL$SQL1\sql\query
c. Protocal : Named Pipe
d. Server : S12345.ca.com (FQDN)



Now, you are ready to use alias in in connection string. 

To validate whether named pipe is being used or not:-

First, you can establish connection from SSMS on client server/your laptop

Second, you can run below query and see the value in net_transport column

Select * from sys.dm_exec_connections order by 1

net_transport -- It must be Namedpipe

Hope it will help you.

Warm Regards,

Chhavinath Mishra
Sr. Specialist Database Administrator

No comments:

Post a Comment