Re: PgSQL behind a firewall

From: Holger Klawitter <lists(at)klawitter(dot)de>
To: nmilet <nmilet(at)sympatico(dot)ca>, "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: PgSQL behind a firewall
Date: 2001-09-28 13:17:23
Message-ID: 3BB47863.570B0E4A@klawitter.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

nmilet wrote:
>
> The question now is how can I set a ssh tunnel (I try to recompile postgres
> with openssl support
> but I did not succeed), and then can I use a ssh tunnel from Java (perharps
> yes by specifying the
> port number in connection).

That's not difficult:

1.) Establish a ssh connecton from the client formwaarding to the
dbhost (port is the port number on the local host being forwarded):
ssh -L port:dbhost:5432 dbhost
or (as I regularly do)
ssh -2 -n -N -L port:dbhost:5432 dbhost
You'll probably have to set up some identities to make this
work conveniently.

2.) Then you can connect to the remote database by using
db = DriverManager.getConnection
( "jdbc:postgresql://localhost:"+port+"/"+dbname, user, pass );
Where post is the local port and dbname is the (remove) database
name.

With kind regards / Mit freundlichem Gruß
Holger Klawitter
--
Holger Klawitter
holger(at)klawitter(dot)de http://www.klawitter.de

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Benjamin Franks 2001-09-28 13:18:40 Re: PostgreSQL 7.1 on SMP: FreeBSD 4.3 || Linux 2.4.x?
Previous Message Marko Kreen 2001-09-28 12:31:57 Re: Encoding passwords