0

I have a PC with SQL Server installed.

I have created a VB.NET application to connect to SQL Server.

When I connect the SQL Server from development machine I can access the remote SQL Server database easily without any problem.

But from the client machine when I try to connect the same SQL Server I get an 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)

  • Firewall is disabled
  • TCP/IP is enabled
  • Port 1433 is defined in the same way as on the development PC

I have tried with Ip: port and IP only to access the remote SQL Server database server.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Does this answer by your question? [Cannot Connect to Server - A network-related or instance-specific error](https://stackoverflow.com/questions/18060667/cannot-connect-to-server-a-network-related-or-instance-specific-error) – Thom A Feb 13 '22 at 19:58
  • it's not, I have already tried all the answers and have not succeeded yet. – Arslan Sadiq Feb 13 '22 at 20:00
  • If all the settings are tight, the. That suggests a firewall issue. Are 2 hosts are on the same network? – Thom A Feb 13 '22 at 20:09
  • 2
    Presumably you can ping by IP address in both directions and can telnet to the server on 1433? – Stu Feb 13 '22 at 20:12
  • _error: 26 - Error Locating Server/Instance specified_ Judging by the error message your connection string is using an instance name, e.g.: `Server=ServerNameOrIpAddress\SomeInstanceName;`. Instance name resolution requires that the SQL Browser service is running and is accessible via udp/1434 - it accepts the instance name and resolves it to the tcp port of the matching instance running on the machine. Since you already know the port number of the instance why not use that in the connection string? e.g.: `Server=ServerNameOrIpAddress,1433;` – AlwaysLearning Feb 13 '22 at 21:08
  • Firewall Disabled already – Arslan Sadiq Feb 13 '22 at 21:15
  • i can ping the server. i already told i can access the server from my Development PC. but when i try to access from client pc it gives error. I have disabled firewall, Browser service is running. – Arslan Sadiq Feb 13 '22 at 21:16
  • I can telnet from my development pc but cant from the client pc. how can I resolve it? – Arslan Sadiq Feb 13 '22 at 21:29
  • Database server is not on same network – Arslan Sadiq Feb 13 '22 at 21:30
  • Is the dev PC and the client PC on the same network? If so then that indicates something about the client PC is different, either the connection string or the firewall. When you say "firewall disabled" which machine are you referring to? You shouldn't normally disable a firewall, except as a diagnostic to work out what the issue is. *"Port 1433 is defined in the same way as on the development PC"* indicates to me that you don't understand networks properly: this is something that is configured on the server. – Charlieface Feb 13 '22 at 22:56
  • The firewall is temporarily disabled just to check if there is something I missed with the firewall, I can create a rule for the firewall after testing. dev PC and Client PC are not on the same Network, even the Server is on another network. my question is when I can connect the server from the development PC, then why the server is not being accessed from another client PC. All three PCs are on different Networks. – Arslan Sadiq Feb 13 '22 at 23:10
  • Again, on *which* PC have you disabled the firewall? Can you ping the server from the client PC? Are you sure that the DNS name (if you are using one) resolves to the same IP address as on the dev PC? – Charlieface Feb 14 '22 at 00:06
  • Disabled firewall on server client & dev pc. – Arslan Sadiq Feb 14 '22 at 01:13
  • I can ping to server from client pc and dev pc. – Arslan Sadiq Feb 14 '22 at 01:13
  • I am accessing via IP. – Arslan Sadiq Feb 14 '22 at 01:14
  • From dev pc database can be accessed – Arslan Sadiq Feb 14 '22 at 01:14
  • From client pc i am unable to access One more thing I can telenet ip:port to sql server But from client pc connection failed when i use telnet – Arslan Sadiq Feb 14 '22 at 01:15
  • What type of authentication is your sql server using? Windows or Mixed mode? – F0r3v3r-A-N00b Feb 14 '22 at 03:52
  • Using mixed mode – Arslan Sadiq Feb 14 '22 at 12:32
  • Please show your connection string – F0r3v3r-A-N00b Feb 16 '22 at 03:34
  • `con = New SqlClient.SqlConnection("Data Source=" & Db.ServerName & "\" & Db.InstanceName & ";Network Library=DBMSSOCN;Initial Catalog=" & Db.DatabasePath & ";User ID=sa;Password=password123;")con = New SqlClient.SqlConnection("Data Source=" & Db.ServerName & "\" & Db.InstanceName & ";Network Library=DBMSSOCN;Initial Catalog=" & Db.DatabasePath & ";User ID=sa;Password=password123;")` – Arslan Sadiq Mar 01 '22 at 15:25

0 Answers0