Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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
>             System.setProperty("http.proxyHost", "");
>             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.

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

pgsql-jdbc by date

Next:From: Samuel GendlerDate: 2010-08-09 12:04:11
Subject: Re: Java proxies connection to postgres
Previous:From: Donald FraserDate: 2010-08-09 11:47:18
Subject: Re: Java proxies connection to postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group