Question

I have two Win 7 64 bit machines.

On the first one I have installed SQL Server 2008 R2 Express and have no trouble connecting via Management Studio with Windows Auth and also via SQL Auth with a user I set up on the database.

On the second machine I am trying to connect to the database on machine 1 using Management Studio. I'm trying SQL Auth. I therefore obviously also can't connect to it via connection string in my .NET Code

I can ping the first machine from the second.

Things I have tried include the following:

On the machine the database is installed make sure the firewall is allowing connection on Port 1433

  • Made sure SQL Server service is running
  • Made sure SQL Server Browser service is running
  • Created an exception for sqlbrowser.exe in the firewall
  • Enabled TCP/IP Protocol through SQL Configuration manager
  • Allowed Remote connections in SQL Server Management Studio

The error I get is:

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

This is the connection string I use in code

Data Source=xxx.xxx.xxx.xxx\sqlexpress;Initial Catalog=dbName;User Id=myUser;Password=myPassword;

Was it helpful?

Solution

This can be caused by a number of reasons but I'm glad my suggestion about checking firewall ports (rather than just allowing a one-way exception for SQL Browser) led you to the answer: the firewall wasn't allowing the correct port # through.

OTHER TIPS

If i remember correctly SQL Server disables remote connections by default. Please check whether remote connections are enabled and enable them if not: RMB on Server in Management Studio Object Explorer -> Properties -> Connections -> Allow remote connections...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top