mtxr / SublimeText-SQLTools

SQLTools for Sublime Text 3
https://code.mteixeira.dev/SublimeText-SQLTools/
GNU General Public License v3.0
177 stars 40 forks source link

Can ST connection support ssh? #117

Closed freemember007 closed 7 years ago

freemember007 commented 7 years ago

Issue Type

Can ST connection support ssh? Because my host cann't expost any port.

michaelwiller commented 7 years ago

Sorry for barging in .... SSH is exposed as a port (port# 22).

mtxr commented 7 years ago

You mean SSH Tunneling? How are you doing to access your DBs?

Tell us how your current work routine is to clarify things better.

tkopets commented 7 years ago

@freemember007 SQLTools works with connections tunneled over SSH, however, you have to manually open SSH tunnel with DB connection as SQLTools does not have a built-in support tunneling.

  1. Tunnel (port-forward) your DB connection to your local port
  2. When connecting with SQLTools add a connection and reference your local forwarded port (5555 in example below) and set host to localhost or 127.0.0.1.
    {
    "connections": {
        "SSH demo": {
            "type"    : "pgsql",
            "host"    : "127.0.0.1",
            "port"    :  5555,
            "username": "postgres",
            "database": "demo",
            "password": "demo",
            "encoding": "utf-8"
        }
    }

Let me know if that worked for you.

tkopets commented 7 years ago

Closing due to lack of feedback.

mathroc commented 7 years ago

I think what @freemember007 meant was for SQLTools to be able to setup the ssh tunnel itself, it’s common for SQL GUI to be able to configure an ssh tunnel for proxying the connection to the remote server, eg: https://dev.mysql.com/doc/workbench/en/wb-mysql-connections-methods-ssh.html

It would be a very welcome feature as it’s cumbersome to manually open an ssh tunnel each time I want to connect to a database through an ssh tunnel. plus, SQLTools could even find out itself an available local port and start the ssh tunnel on this port.