1

I have a remote SQL Server: myremotedb.myremotedomain.gbl.

I could connect to it from another server myserver.myareadomain (not in the same domain) using SQL Server Management Studio without problem.

But I couldn't ping it from my server (myserver.myareadomain), nor connect to it via the program that we developed.

PS: I don't have admin right on the remote server.

Do you have any ideas?

8
  • 1
    If you can't even ping the server, this is a networking issue first, not a database issue. Jun 2, 2016 at 13:05
  • What Aaron Bertrand and Sting said. If you can connect via SSMS but not with ping or with a different program, this is probably a firewall problem. Make certain that the ports the program you developed use are actually open on the SQL server and not blocked anywhere in between. Jun 2, 2016 at 20:58
  • 2
    Internet facing servers usually have ping turned off so don't worry about that too much. If the issue is primarily around connecting from your application you need to do some investigation and find an error message and post it.
    – Nick.Mc
    May 30, 2017 at 0:32
  • 1
    Just because you cant ping it, doesnt mean it s there.. it maybe that port 1433 (or whatever) is the only port open, this is exceptionally common in secure environments
    – BugFinder
    Jul 3, 2017 at 11:06
  • Ask the server & network admins to help you determine how you can connect to it from the subnet & on which ports from these subnets. I'm not sure if you are connecting from the outside world via the Internet or internally across site VPNs, etc. & this is where you are having trouble. What port you connect to SQL Server with & what port ICMP uses are two different ports so that tells you absolutely nothing unless you know 100% ICMP is wide open but you're not the admin so really you need to work with them & ensure your connect is using the correct connection ports, etc. Aug 18, 2017 at 22:45

2 Answers 2

0

If you can situationally access SQL Server over the network, this sounds like a firewall issue. To quickly test, simply turn the firewall off on myremotedb.myremotedomain.gbl first. Then, retest the application connectivity. If that doesn't work, turn the firewall of on your app server and retry connecting.

Baring that, I'd start testing ports using nmap to see which ports are able to get through to the target server. nmap is like ping but allows you to test port numbers as well. Test to see whether you can nmap port 1433 (the default sql port) from the app server to myremotedb.myremotedomain.gbl.

https://nmap.org/book/inst-windows.html

0

If SQL Studio can connect and your custom app cannot, there's probably some difference in the connection strings. Try forcing a TCP connection (e.g., Server=tcp:myremotedb.myremotedomain.gbl; Database=...).

This is a shot in the dark; I hesitate to even offer it as an answer, but I have seen it fix this problem before. If you've already validated that the server name, credentials, and port are the same between the two, this is what I'd try next.

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.