Re: Java proxies connection to postgres - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: Java proxies connection to postgres
Date
Msg-id 4C5FECE4.8090205@postnewspapers.com.au
Whole thread Raw
In response to Re: Java proxies connection to postgres  (- <grandebuzon@gmail.com>)
List 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

pgsql-jdbc by date:

Previous
From: "Donald Fraser"
Date:
Subject: Re: Java proxies connection to postgres
Next
From: Samuel Gendler
Date:
Subject: Re: Java proxies connection to postgres