Search Suggest

Speaking to Sql Server, between Shared Memory, Named pipe and TCP/IP protocols

Hi Friends,

I hope you have had an Happy Easter!

Have you ever wondered how your application or the SSMS itself talks to the database engine? Let's start today by talking about some basic concepts: Protocols

GO!

 

Speaking to the database engine.

You know already, from the previous posts, that SQL Server engine is a service.

The database engine is a service

 

The question of today as sayd is: how do the applications speak to this service? How does he respond?

Well, to talk to SQL Server there are three protocols that you can view by starting Sql Server Configuration Manager.


These three protocols are named:

  • Shared Memory
  • Named Pipe
  • TCP/IP

Basically:

  • With the Shared Memory protocol, the simplest protocol, you can only use it in a local connection. In this case the application and the SQL Server need to run on the same machine.
  • The Named Pipe is used to connect inside a local area network (LAN) 
  • With the TCP/IP protocol (the most used) you can have a remote or client/server connection.
Shared  memory is the fastest protocol if your application and SQL Server run on the same machine. The TCP/IP is the most used.

 

The SQL Server Express version

Note that: 

In the SQL Server Standard version the TCP/IP is enabled, while in the SQL Server Express version the TCP/IP is disabled by default and so a remote client can't connect.

Remeber that you can anyway enable the TCP/IP protocol from the Property page of the TCP/IP protocol:

Remember to set the default TCP/IP port to 1433.

You SQL Server need a restart but then you can use it in your client/server application.

Oh ... a little tips!


How to understand which protocol is used? 

Question: If now i wanted to see which protocol is used?

Well you can execute the following DMV:

Select net_transport,* from sys.dm_exec_connections

This is the result.

In my case i am using the Shared Memory protocol:


That's all for today my friends!
I hope you enjoyed this post! In this case show it to your friends and/or colleague, please!

Luca













Previous post:All about prepared statements. When to use them to go faster!

Post a Comment