Re: Java proxies connection to postgres

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: - <grandebuzon(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Java proxies connection to postgres
Date: 2010-08-09 11:56:20
Message-ID: 4C5FECE4.8090205@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 09/08/10 18:34, - wrote:
> Thanks for answering.
>
> I planned to use free public proxy, which supports HTTPS
>
> //free public proxy finded in google.com
> System.setProperty("http.proxyHost", "189.19.44.164");
> System.setProperty("http.proxyPort", "3128");

Those properties only affect the HTTP client classes. They have nothing
to do with JDBC connections over custom protocols. Those lines have
absolutely no effect on the JDBC connection.

If you want to tunnel PgJDBC over a HTTP proxy, you will have to know a
***LOT*** more about how HTTP works and how HTTP proxies work, how the
PostgreSQL protocol works, how TCP/IP connections are created and
managed in Java, the Java HTTP client classes, etc.

Even then, it might not work. You would have to be able to use a HTTPs
proxy with CONNECT support to have any chance at all. Not all proxies
allow this method. A regular HTTP proxy can not possibly do what you
want. Even with a CONNECT-supporting proxy, you will have to be capable
of understanding and modifying the JDBC driver code to use a custom
SocketFactory that you have written. This SocketFactory would have to
set up a HTTP CONNECT tunneled connection via the proxy.

http://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_Tunneling

I'm not sure that's a good thing to tackle, based on reading your mail.
If you really cannot get the proxy changed, and it's too smart to let
you just connect directly by having PostgreSQL listen on port 443
instead of the default port, you're going to be in trouble.

Instead, you might want to see if you can get an application server set
up on the same network as the database, and use that to do all your
database access over HTTP REST calls. It's ugly, but probably less ugly
and more reliable than trying to tunnel PgJDBC over a HTTPs
CONNECT-enabled proxy.

--
Craig Ringer

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Samuel Gendler 2010-08-09 12:04:11 Re: Java proxies connection to postgres
Previous Message Donald Fraser 2010-08-09 11:47:18 Re: Java proxies connection to postgres