1

I try to connect to a remote windows server that has a SQL Instance running using SQL Authentication via my local SSMS and this the error I get:

Cannot connect to 123.123.123.123\WIN-ODF1AGSBGZ
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

Steps I made:

  1. Open port on the server to TCP 1433 - Inbound Rules
  2. SQL Server Configuration Manager - SQL Server (mssqlserver), SQL Server Browser, SQL Server Agent are running
  3. Allow remote connections to this server is checked

How I try to connect to the instance:

  • Server name: 123.123.123.123/WIN-ODF1AGSBGZ
  • Authentication: SQL server authentication
  • Login: same user name as in remote
  • Password: same password as in remote

Remote server

1

1 Answer 1

1

You try to connect to a named instance, meaning that the client tries to use port 1434 UDP to talk to the SQL Server Browser service on that machine in order to determine what post number the instance is listening to and then try to connect using that port.

But then you say that you opened port 1433. 1433 is for a default instance. A named instance uses by default some other port, hence the behavior I mention above.

You first need to determine whether it is a default or a named instance. And in particular what port it is listening it.

  • If it listens to 1433, then you don't use the backslash-instance name part.
  • If it is a named instance and listens to something else, then open 1434 UDP and TCP for the port that the named instance is listening to.

You can for instance use SQL Server Configuration Manage to see what port it is listening on.

4
  • From checking the instances I have installed on the machine I have only MSSQLSERVER, isn't the default instance name?
    – Offir
    Commented Aug 3, 2021 at 8:52
  • I use this to figure it out: DECLARE @GetInstances TABLE ( Value nvarchar(100), InstanceNames nvarchar(100), Data nvarchar(100)) Insert into @GetInstances EXECUTE xp_regread @rootkey = 'HKEY_LOCAL_MACHINE', @key = 'SOFTWARE\Microsoft\Microsoft SQL Server', @value_name = 'InstalledInstances' Select InstanceNames from @GetInstances
    – Offir
    Commented Aug 3, 2021 at 8:56
  • I checked SQL Server configuration and under all Client Protocols -> TCP/IP -> Default Port = 1433.
    – Offir
    Commented Aug 3, 2021 at 9:07
  • 2
    If you have only one instance, and that is a default instance, then you should connect using only the IP adress or only the machine name (not both). and no backslash. Commented Aug 3, 2021 at 14:11

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