-1

I've configured a remote Sql server on host machine. I have performed the follwing steps : Under Remote Server Connections, check the box against "Allow remote connections to this server". Make sure that the TCP/IP Protocol Name is Enabled. Navigate to the IP Addresses tab and scroll down to the section named "IPAII". If the TCP Dynamic Ports is set to 0 (indicates the Database Engine is listening on dynamic ports), then remove the 0 and set it to blank. Update the value for TCP Port to 1433. Restart the service.  Windows Firewall setting inbound rule TCP, port 1433 , Allow the connection 

Using this setup I'm able to connect from SSMS using aa.aaa.aa.aaa\SQLEXPRESS and from c# app using the following aa.aaa.aa.aaa\SQLEXPRESS,1433. I would like also to be able to connect using the host name instead of ip address. Is this possible? I have tried in SSMS using hostname\SQLEXPRESS or hostname\SQLEXPRESS,1433 but it doesn't connect and an error is shown saying : 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: TCP Provider, error: 0 - The wait operation timed out.) (Microsoft SQL Server, Error: 258)

I should be able to connect also via the machine name. For local sql server it works to connect via hostname\sqlinstance.

4
  • Does this answer your question? Can't connect to remote SQL server from some machines Jan 28, 2021 at 16:28
  • No because I can connect through ip address but using hostname not. Also if I ping the server ip address it is responding but with hostname i received timeout.
    – Elena2020
    Jan 28, 2021 at 16:37
  • I really don't know why pinging by address works but pinging by host name not.
    – Elena2020
    Jan 28, 2021 at 17:01
  • Can you connect specifying the hostname alone (without \SQLEXPRESS added)?
    – Dan Guzman
    Jan 28, 2021 at 17:27

1 Answer 1

1

I really don't know why pinging by address works but pinging by host name not.

Because your hostname resolution is failing. If you have a DNS server for your network, look there, otherwise you'll have to add an entry in your hosts file for the other machine.

3
  • I've noticed that on server machine is missing the file host.ics, in my laptop is present .
    – Elena2020
    Jan 28, 2021 at 20:09
  • The hosts file on Windows is c:\windows\system32\drivers\etc\hosts Jan 28, 2021 at 20:43
  • In both server, client in hosts I have 127.0.0.1 localhost # ::1 localhost.The only difference is that client machine has another file hosts.ics
    – Elena2020
    Jan 28, 2021 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.