0

I have a SQL Server in RDS in private subnet on port 1433.

I open a SSH tunnel and use local port 21433.

I am not able to connect it using SSMS if I give db host as localhost,21433 or .21433

Please advise what the connection string needs to be in this case, even sqlcmd did not work.

enter image description here

I am able to connect same DB using another clinet "Dbever"

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
forvaidya
  • 3,041
  • 3
  • 26
  • 33
  • 1
    Try `tcp:localhost,21433`, or even `tcp:127.0.0.1,21433` or `tcp:::1,21433`. `localhost,21433` *should* work on its own, though -- if it doesn't the port is likely not the problem (but, for example, the authentication). – Jeroen Mostert Jun 06 '21 at 12:06
  • 1
    Are you sure that the SSH tunnel is working properly? If you can't telnet to localhost on port 21433 then `localhost,21433` isn't going to work in SSMS either. – AlwaysLearning Jun 06 '21 at 12:09
  • Wow !! tcp:::1,21433 worked – forvaidya Jun 06 '21 at 14:10
  • That should mean the tunnel is configured for IPv6 only, which is an unusual configuration -- especially since it should mean `localhost` does not resolve to the IPv6 localhost. But if it works it works, I guess. – Jeroen Mostert Jun 06 '21 at 14:27
  • it was ipv4, howver tcp: in the connection string made it working. I guess without tcp: it must be using Local Sockets. – forvaidya Jun 08 '21 at 01:58

1 Answers1

1

Follow this steps :

  1. Open the SQL Server Configuration Manager and expand the node SQL Server Network Configuration. Then Select Protocols for SQLEXPRESS (or whatever the name of your SQL Server instance is). Make sure that TCP/IP protocol is enabled.
  2. Right click on TCP/IP and choose Properties. In the TCP/IP Properties dialog box, click on the IP Addresses tab and scroll down to IPAII section. Make sure TCP Dynamic Ports is blank and that TCP Port is set to 1433 (or whatever you want to set TCP Port). 3.First Click on Apply button and then the OK button to save your changes. After that restart your SQL Server instance.

Now you are able to connect to your SQL Server instance remotely using SQL Server Management Studio.

If there is problem persist in remote connection, you most likely need to configure your firewall settings. Make sure the TCP port 21433 is not blocked by your firewall.

Reza Faghani
  • 141
  • 1
  • 10