Why can't I connect to external database?

I have a website that connects to a MSSQL database on a different server. I can see in the Fly Dashboard that there is an IP address so I set up the database server to allow that IP address through and I have set up a username and password to allow external access to it. It works fine in Docker when run locally, however when I upload it to Fly I get the following error:

com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host , port 1433 has failed.

Am I using the correct IP address to allow through? Is there anything else I need to do to allow the connection from fly to the external database? Does fly even allow connecting to an external database?

Are you using the new egress-ip feature? I don’t think the standard ip works since it’s different when outgoing.

the weird thing is that if I disable the firewall for the database on the external server, the connection get’s through. I’ve tried whitelisting the IP address but it doesnt work. Our hosting company has asked me to run a tracert command from within fly but i’m not sure how to do that, any ideas?

That doesn’t sound weird at all, when you disable firewall that means it’s not blocking any IP right?
Did you answer my original question? I don’t know what you deleted above.
You can fly ssh console -a appname and do the trace there.

I deleted a duplicate post.

I’ve set up the egress-ip feature but when I look at my dashboard there are two machine IDs. If I set up one then the website connects so yay! but how would that work if one goes down as they both have different IP addresses.

Also when I logged into the fly console I couldn’t get tracert to work, just got this message:

-bash: tracert: command not found

Is the command for trace route different?

traceroute might not be preinstalled on your linux distro, you have to ssh into your machine and install it.
I don’t use egress-ip so I don’t know if that applies per app or per machine. If it’s per machine, then you’ll have to add each to the IP whitelist.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.