Java SSH + Postgres

138 views
Skip to first unread message

Louis Botes

unread,
Nov 30, 2011, 6:17:05 AM11/30/11
to Cape Town Java Users Group
Hi All,

I have a requirement to connect to a Postgres Database through an SSH Tunnel.

I have previously done this, but the SSH Tunnel connection was always opened and maintained by the underlying OS.  This time round however I would like to control the tunnel directly from Java. Specifically check if it is open, and if not establish the tunnel then connect to my database.

Loads of libraries out there, but I figured I would ask here first before I waste time learning lessons some of you may already have figured out.

Any ideas/advice will be much appreciated.

Regards,

-- 

Louis Botes

Support +27 (0) 83 307 9512
Office     +27 (0) 21 488 3940
Fax          +27 (0) 21 422 0597
Mobile +27 (0) 82 907 0980

www.evosat.com

P Please consider the environment before printing this e-mail 

Sebastian

unread,
Dec 1, 2011, 12:54:07 AM12/1/11
to ctjug...@googlegroups.com
Hi,

you might want to look at Jsch (http://www.jcraft.com/jsch/). They have
a couple of examples (http://www.jcraft.com/jsch/examples). An article
describing how to use the JSch lib:
http://www.beanizer.org/site/index.php/en/Articles/Java-ssh-tunneling-with-jsch.html

Regards,
Sebastian

> --
> You received this message because you are subscribed to the Google
> Groups "CTJUG Forum" group.
> To post to this group, send email to CTJUG...@googlegroups.com
> To unsubscribe from this group, send email to
> CTJUG-Forum...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/CTJUG-Forum
> For the ctjug home page see http://www.ctjug.org.za
> For jobs see http://jobs.gamatam.com/


Reply all
Reply to author
Forward
0 new messages