views:

41

answers:

3

Hi guys,

Trying to connect to a SQL Server 2005 instance remotely but getting the following exception:

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)

Have checked and the server is enabled to accept remote connections. Connection string I'm using in .NET looks like this:

Data Source=SERVERIP\INSTANCE;Initial Catalog=DATABASENAME;User Id=USERNAME;Password=PASSWORD;

Any ideas? Thank you :)

+3  A: 

Make sure the SQL Server Browser service is started on the remote machine, and that the firewall allows connections through port 1433 and 1434. And of course this is provided the instance you are trying to access does exist.

BrokenGlass
+2  A: 

You might want to try a quick telnet to TCP port 1433 of the server to see if you can establish a connection that way.

telnet remote_name_or_ip 1433

If you can't, you know that it's at the network layer, and you can start checking things like the Windows Firewall or other network pieces that might get in your way. (You also need access via UDP to port 1434.)

Ken Smith
+1  A: 

Another check on the sql server: Start->All Programs->Microsoft SQL Server 2005->Configuration Tools->SQL Server Configuration Manager->Protocols for MSSQLSERVER->TCP/IP Enabled

Danny Chen