How can I connect to remote MySQL database through SSH from java application? Small code example is helpful for me and I’d appreciate this. Answer My understanding is that you want to access a mysql server running on a remote machine and listening on let’s say port 3306 through a SSH tunnel. To create such a tunnel from port 1234