-2

I have two nodes in a Failover Cluster. There are three SQL roles / instances installed. I can connect to any instance with SSMS from a different computer by using RoleServer\InstanceName. One of the instances is being used by a third part app running on Apache. The JDBC URL seems to need a port number. How do I verify which port number the instance is using?

2 Answers 2

2

In a Failover Cluster each instance has its own IP address, so all the instances can (and should) simply listen on port 1433. In any case the SQL Server log will tell you what IP addresses and ports the instance is listening on. You can look at the log, or run a query like

exec xp_readerrorlog 0, 1, N'Server is listening on' 

which will output something like

LogDate                 ProcessInfo  Text
----------------------- ------------ -------------------------------------------------------------------
2023-10-16 15:19:51.040 spid51s      Server is listening on [ 'any' <ipv6> 1433] accept sockets 1.
2023-10-16 15:19:51.040 spid51s      Server is listening on [ 'any' <ipv4> 1433] accept sockets 1.
2023-10-16 15:19:51.040 Server       Server is listening on [ ::1 <ipv6> 1434] accept sockets 1.
2023-10-16 15:19:51.040 Server       Server is listening on [ 127.0.0.1 <ipv4> 1434] accept sockets 1.
2023-10-16 15:19:51.040 spid51s      Server is listening on [ ::1 <ipv6> 49852] accept sockets 1.
2023-10-16 15:19:51.040 spid51s      Server is listening on [ 127.0.0.1 <ipv4> 49852] accept sockets 1.

Also before connecting using a port number, ensure that the instance isn't using a dynamic port which will change on restart.

1

For SQL Server, try port 1433 for most connection strings. See List of TCP and UDP port numbers - Wikipedia

If your connection string is otherwise correct but your instance is exposed on a non-standard port, you should ask your network administrator. See also: security - Is it still best practice to avoid using the default ports for SQL Server? - Database Administrators Stack Exchange

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.