Setup a SSH tunnel in IntelliJ

There seems to be a problem with the older MySQL driver and IntelliJ Ultimate. When I tried to connect to a remote MySQL instance using a tunnel, IntelliJ would refuse to connect. IntelliJ would show an error similar to the following: Cannot connect to a database. Tried three times. The linked online help page was not really helpful. I could create the tunnel manually and verify the settings, all seemed fine.