How to SSH tunnel and connect to a database using IntelliJ and JDBC?

前端 未结 3 1726
攒了一身酷
攒了一身酷 2021-02-20 14:15

I\'m having issues connecting to a database hosted on a server using IntelliJ and JDBC. With the command line, the command:

ssh username@server -L 11100:ct1:2801         


        
3条回答
  •  星月不相逢
    2021-02-20 15:11

    Here's my setup via intellij if anyone is looking for simple solution without external libraries.

    1. Open Database view (View -> Tool Windows -> Database).
    2. 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).
    3. Fill in rest of the fields as configured on your remote host.

    Now click on SSH/SSL tab and configure ssl tunnel:

提交回复
热议问题