Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6A3A5632ADB for ; Mon, 9 Aug 2010 09:50:14 -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 18958-05 for ; Mon, 9 Aug 2010 12:50:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.cisx.com (mail.cisx.com [213.133.202.139]) by mail.postgresql.org (Postfix) with ESMTP id 379696327A7 for ; Mon, 9 Aug 2010 09:50:06 -0300 (ADT) Received: from DEVELOP1 ([192.168.100.50]) by mail.cisx.com (8.13.1/8.13.1) with SMTP id o79CnvQu027160 for ; Mon, 9 Aug 2010 13:50:03 +0100 Message-ID: <72F787BB59B24A4C82BF8CDCB509AC17@DEVELOP1> From: "Donald Fraser" To: "[JDBC]" References: <4C5EB971.7000403@postnewspapers.com.au><7BF0F1662EE14F6FA6F3C8EFE951A69F@DEVELOP1> Subject: Re: Java proxies connection to postgres Date: Mon, 9 Aug 2010 13:49:49 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5843 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.461 tagged_above=-10 required=5 tests=BAYES_00=-1.9, STOX_REPLY_TYPE=0.439 X-Spam-Level: X-Archive-Number: 201008/34 X-Sequence-Number: 20837 > The problem with using an HTTP proxy to proxy a connection to your > database server is that an http proxy is surely counting on the > protocol to be http. I imagine that just about any proxy made since > 1995 supports arbitrary port numbers, but that really sin't > sufficient. A proxy that is expecting to read and parse http headers > such as content-length and connection will totally fail to behave > correctly if those headers are not available. You need, at minimum, > what is called a SOCKS proxy. We have 30+ clients all using HTTP proxies to connect to our database. It works be cause as previously stated you must use SSL. That is, as soon as you specify the target port to be 443, the proxy has to let the packets pass through un touched otherwise SSL handshake will not work. We haven't found a HTTP proxy that doesn't work with this technique. What gives us the most headaches are proxies with authentication and in particular single sign-on authentication. In a lot of cases our clients have to set up special rules for our software, which they hate doing ! >Not to mention the fact that the connection will not persist. Even if >you got this to work by modifying the listening port of the driver you >would have to open and close each request. 95% of our clients have no connection problems since secure connections are not closed down immediately because how does the proxy know when a request is complete or not? The proxy cannot inspect secure data. However there are some nasty proxies that simply shut down a connection after x amount of time, even when data is constantly flowing over the connection! Because of the 5% that we do have connection problems with, we had to implement a reconnect algorithm and to make it truly work you need session management added to both client and the PostgreSQL server so that you can identify and close down dead connections easily... So in summary, while it is possible do achieve connections via proxies, if you can avoid going down this path then avoid it. Take it from someone who has done it, its a lot of hassle! Another solution: package everything up and use a message queue system. Most of the JMS implementations have support for messaging over HTTP (with single sign-on support) and you get asynchronous messaging as opposed to synchronous. Regards Donald Fraser