How to SSH tunnel and connect to a database using IntelliJ and JDBC?
Here's my setup via intellij if anyone is looking for simple solution without external libraries.
- Open Database view (View -> Tool Windows -> Database).
- Add new DataSource (right-click, New -> Data Source -> Postgres/Mysql). In host, use 127.0.0.1 (not localhost, sometimes localhost is not properly resolved).
- Fill in rest of the fields as configured on your remote host.
Now click on SSH/SSL tab and configure ssl tunnel:
Do you connect to SSH server from a java client like SSHJ (https://github.com/hierynomus/sshj) ?
The URL on your DriverManager seems wrong: try port 11100 instead.