Sql-server – Cannot connect remotely to sql server 2012 instance using SSMS

remotesql-server-2012ssms

I have installed sql server 2012 Express on a local network machine, then added a new login: "sqlUser" mapped to "database1", and configured the instance to accept the remote access with both Windows and SQL Server authentication.

In the configuration manager -> SQL Server Network configuration -> Protocols for SQLEXPRESS -> TCP/IP properties, I have configured the IP to use TCP dynamic port: 12345 and TCP static ports is left blank, the IP2 have the static local IP address of the local network.

In the firewall I have added a new rule to allow the sql server program (exe) to accept remote connection.

Locally I can run SSMS and open database1 with both authentications using sqlUser account.

ping from the internet is successful. http site in the same sql server machine is reachable.

But when I want to access sql server instance from an internet machine using SSMS and sql server authentication:

Server:   123.123.123.123\SQLEXPRESS:12345  
Login:    sqlUser 
Password: pass123

I get the following error:

Cannot connect to 123.123.123.123\SQLEXPRESS.

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)

Any suggestion please ?

Best Answer

You should not need to specify the port for a named instance (that's kind of the point of the name - and since it's dynamic you won't want to hard-code a port into your connection strings etc. unless you want to change your config files every time the port changes). Try connecting to:

123.123.123.123\SQLEXPRESS

Also make sure that your server is exposed to the Internet on that port (firewalls may be preventing this) and that the SQL Browser service is running.

PS Ping means nothing. You need to try to telnet to the port that SQL Server is exposed on.