SSH tunneling with Java, a database connection example
This blog is about using SSH tunnel in Java through jsch, a Java an implementation of SSH2. As an example, we connect to an MySQL installation in a remote host behind a firewall which not accessible from the outside. What an SSH tunnel does is forward accesses from a local port to a remote port on a remote host and transfer data in a secure manner.
First download jsch here http://www.jcraft.com/ and add it to your project. The only requirements are, you have to have an SSH account on the remote host, and for the database example, a database account with a "connect" permission.