PDA

View Full Version : help connecting to postgresql db




sk3pt1c
Mar 6, 2006, 05:59 AM
ok, i've been told to do this with putty which is for windows, but i wanna do it via terminal using bash. how do i set up the tunneling?can someone help out?

1. In Putty, on the 'Session' configuration screen set it to connect using SSH to biscotti.cic.hull.ac.uk or nervosa.cic.hull.ac.uk as normal.
2. Putty SSH tunnel configuration screenshotStill in Putty, select the 'Tunnels' section under 'SSH' and in the bottom section labelled 'Add new forwarded port' enter '4000' for 'Source port' and 'alexandria.cic.hull.ac.uk:5432' as 'Destination'. Press the 'Add' button. The screen should look like this:
3. Press the 'Open' button in Putty to initiate the connection. Log in as normal and leave Putty running - it will catch all traffic on port 4000 and forward it to alexandria (the database server) via the SSH connection to nervosa or biscotti.



sk3pt1c
Mar 6, 2006, 09:42 AM
my aim is to access a database i've created at uni via pgadmin on my powerbook

anyone?

jeremy.king
Mar 6, 2006, 01:00 PM
In Terminal...


ssh -L 4000:alexandria.cic.hull.ac.uk:5432 biscotti.cic.hull.ac.uk

or

ssh -L 4000:alexandria.cic.hull.ac.uk:5432 nervosa.cic.hull.ac.uk



Leave terminal running and the tunnel will remain open until you close the SSH session or exit terminal.

Of course, you can optionally pass in a login name (two ways, one with a -l option or username@host) so it would then only prompt for a password. You can even save the session as a term file (http://searchdocs.info.apple.com/article.html?artnum=86134&coll=cp) so you would just double click a shortcut and it would then prompt for your password, so you don't have to always type the commands. Alternatively, you could save it as a shell script...Many ways to kill this tunnelling bird.

Edit: Always remember man is there for a reason.


man ssh

sk3pt1c
Mar 6, 2006, 01:58 PM
am not that good at unix, sorry

done it and pgadmin says that the remote host basically said no to the connection

any ideas?