Git Product home page Git Product logo

Comments (6)

sasha-alias avatar sasha-alias commented on May 30, 2024 1

The common approach for such cases is to establish a ssh tunnel:

nohup ssh -L 6001:127.0.0.1:5432 -N [email protected] -i ~/.ssh/id_rsa > /dev/null &

And then to connect to database using connection string postgresql://db_user@localhost:6001/production

Thus you are not limited to any particular tool.

from sqltabs.

dimitrid avatar dimitrid commented on May 30, 2024

Yes, it is a good point. Just nice to not have this overhead every time I connect. I can close the issue if this is the recommended workaround.

from sqltabs.

CzechJiri avatar CzechJiri commented on May 30, 2024

while this is a workaround, it is pain in the neck when you have 10+ DBs and constantly juggle ports etc... not to mention when the ssh freezes (e.g. when you unplug your laptop from the network) and your ssh holds the port

this is pretty much the main reason why I keep using Navicat (though SQL Tabs is so much snappier and cleaner for simple scripting)

from sqltabs.

sasha-alias avatar sasha-alias commented on May 30, 2024

@CzechJiri
I usually have a bash script which reestablishes the tunnels after connection got dropped. I know your pain, I have much more than 10 databases to handle and all are trough ssh tunnelling.
For the moment I can only suggest a little trick I use for tunnelled connections: since it's hard to recognise the connection by port it's possible to name a connection, if you add an alias to the end of connection string separated by 3 dashes like this:
postgresql://db_user@localhost:6001/production --- PRODUCTION

Also I reopen the issue. So it waits for the proper time.
As a draft highlevel design I propose to use a pipeline to make a tunnelled connections:

ssh://sshuser@sshhost:ssport?identity_file=~/.ssh/id_rsa | postgres://pguser@localhost:5432/dbname

Comments are welcome

from sqltabs.

CzechJiri avatar CzechJiri commented on May 30, 2024

nice trick with the alias, like it a lot

I use ruby ssh gateway library, never used JS library. From the first glance looks simple https://github.com/Finanzchef24-GmbH/tunnel-ssh

from sqltabs.

sasha-alias avatar sasha-alias commented on May 30, 2024

released with v0.14

from sqltabs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.