0

I set up an alias in SQL Server Configuration Manager and it works on the local machine. However, if I try to connect to it from a remote machine, the connection only goes through if I explicitly set the port number via the comma (e.g. FooServer\Apple,1433).

Without specyfing the port number I get this:

------------------------------ Cannot connect to FooServer\Apple. ------------------------------ ADDITIONAL INFORMATION: 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) 

So I'm wondering if there's a way to be able to connect to the SQL instance with the Alias without having to explicitly set the port?

1 Answer 1

0

If you need an alias to work on a remote machine, it needs to be setup on the remote machine as well. It would be better, in my opinion, to use a DNS alias instead of a SQL Server alias in most instances.

If the port number is bothering you and the reason why the alias is being made then there are a few things you can do.

  • Change the port to 1433 and use only the machine name
  • Use a network load balancer with a DNS alias to repoint
  • Use a SQL Alias on each machine

In your information, the port is set to 1433 even though it is a named instance - so why doesn't it work? This is because when you give a connection string in the form of Machine\Instance the driver will attempt to contact the Browser Service to look up the port number. Since you're using the default part of 1433, there is no need to give the instance name - connecting to FooServer should be suffice.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.