How to connect to mysql app from java app?

If it was going to be remote long-term then you might want the fly.dev address mentioned above. (A complete WireGuard tunnel is usually a better option for that kind of scenario, though.)

Since that isn’t the plan, in reality, sticking with fly proxy is the path of least resistance—in my view.

(Granted, some users have been reporting sporadic DNS glitches with it, which may have been what you were seeing earlier.)