Pages

Thursday, July 25, 2013

Endpoints in SQL Server

What is an ENDPOINT in SQL SERVER


ENDPOINT is a gateway to enter into the SQL SERVER.

Each and every connection established to the SQL SERVER has to come through an ENDPOINT.

For Eg: Assume SQL SERVER as a GATED COMMUNITY where you have only one main entrance to enter. That is through Main Gate. This Gate is called as ENDPOINT to the GATED COMMUNITY.

Similary, SQL Server will have ENDPOINTS through which it allows client connections to enter.

ENDPOINTS is establised on PORT NUMBERS which are the GATEWAY from the firewall to enter into the WINDOWS SERVER where SQL Server is installed.

We have to have a clear distinguishing idea on ENDPOINTS / PORTS / PROTOCOLS.

PROTOCOL is a WAY to connect to SQL Server.

More information on protocols can be explored below

http://manage-sqlserver.blogspot.in/2012/08/find-protocol-used-by-session-to.html

PORT NUMBER is dedicated number provided by INTERNET AUTHORITY to each and every different Application/Software.

If we are supposed to create any dynamic ports for SQL SERVER or any new endpoints, good practise is to consider port above 50000.

Port details as per given server can be find:

http://manage-sqlserver.blogspot.in/2012/10/find-ports-information-in-server.html

Query to find the ENDPOINTS:

Select * from sys.endpoints

Select * from sys.tcp_endpoints 

/* to find TCP ENDPOINTS, this will include the dynamically created endpoints as well */

Creating a dynamic Endpoint:

Create endpoint endpointname
state=started
as TCP
(Listener_port= portnumber , Listener_ip=All)
for TSQL();
GO

/* Changes needed in the above syntax are
endpointname = Valid ENDPOINT name
portnumber = give any port number that is up (check with NETWORK TEAM) Give above 50000 to avoid any confusion
Listener_ip = ALL (will accept all connections from outside), Particular IP = Will accept only that IP connection.
*/

Above syntax will create a dynamic endpoint.

Hope the above information helps