Ranjith Venkatesh
Ranjith Venkatesh

Reputation: 1362

Connecting to SQL Server 2008 R2 Express on same subnet

PC1 - Windows 7 SP1 64 bit and PC2 - Windows 8 Pro 32 bit

I am able to PortQry port 1434 UDP from PC1 to know that the server is available in PC2.

However with the below code I get an Error. What am I missing?

Code: string connectionString = string.Format("User Id=user1;" + "password=pwd_value;" + "Data Source={0};", sqlServerInstance); var connection = new SqlConnection(connectionString);
connection.Open();

Error: 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)

Upvotes: 0

Views: 348

Answers (2)

Endrju
Endrju

Reputation: 2456

Start with this list:

  • Make sure that SQL Browser service is running on the PC where the SQL Server is installed.
  • Enable remote connections to the SQL Server (with SQL Server Configuration Manager utility -> SQL Server Network Configuration). By default SQL Server denies remote connections.
  • Make sure you're added appropriate rules to Windows Firewall to enable connections to SQL Browser and SQL Server.

Upvotes: 1

w33mhz
w33mhz

Reputation: 370

Have you installed the SQL 2008 Native Client? That maybe your issue.

http://www.microsoft.com/en-us/download/details.aspx?id=16978

Upvotes: 0

Related Questions