Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E008C632573 for ; Mon, 9 Aug 2010 08:56:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 90749-08 for ; Mon, 9 Aug 2010 11:56:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.4.227.11]) by mail.postgresql.org (Postfix) with ESMTP id 3B61C63231A for ; Mon, 9 Aug 2010 08:56:39 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 76ECE9F7F; Mon, 9 Aug 2010 19:56:35 +0800 (WST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 1D74EAF907; Mon, 9 Aug 2010 19:55:14 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4je0+Lpjf6MA; Mon, 9 Aug 2010 19:55:08 +0800 (WST) Received: from [10.1.1.3] (124-169-225-224.dyn.iinet.net.au [124.169.225.224]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 867F0AF8FC; Mon, 9 Aug 2010 19:55:08 +0800 (WST) Message-ID: <4C5FECE4.8090205@postnewspapers.com.au> Date: Mon, 09 Aug 2010 19:56:20 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: - CC: pgsql-jdbc@postgresql.org Subject: Re: Java proxies connection to postgres References: <4C5EB971.7000403@postnewspapers.com.au> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/29 X-Sequence-Number: 20832 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