X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 89B9311F6AC5 for ; Thu, 6 Apr 2006 05:04:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81466-05 for ; Thu, 6 Apr 2006 05:04:29 -0300 (ADT) X-Greylist: delayed 17:23:42.782802 by SQLgrey- Received: from alpha.uhasselt.be (alpha.uhasselt.be [193.190.2.30]) by postgresql.org (Postfix) with ESMTP id 9ED2111F6ABD for ; Thu, 6 Apr 2006 05:04:30 -0300 (ADT) Received: from localhost (datastorage.uhasselt.be [193.190.2.17]) by alpha.uhasselt.be (Postfix) with ESMTP id 473F21AB1F9 for ; Thu, 6 Apr 2006 10:04:27 +0200 (CEST) Received: from [127.0.0.1] (unknown [193.190.10.8]) by alpha.uhasselt.be (Postfix) with ESMTP id 9B1211AB1F8 for ; Thu, 6 Apr 2006 10:04:26 +0200 (CEST) Message-ID: <4434CB81.8000909@quesd.com> Date: Thu, 06 Apr 2006 10:04:17 +0200 From: Stefan Verkoyen User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: do XA connections support SSL? References: <4433D6EB.8000702@quesd.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by Amavisd antivirus & antispam cluster at uhasselt.be X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200604/59 X-Sequence-Number: 14993 Kris, thanks for your comments. I decided to try to patch the XA datasource code. Luckily the datasource relies heavily on the pgjdbc driver which already supports SSL. I'm no pgjdbc expert so I might have done something wrong. In any case, the patch below works for me. I post it here for anyone looking for XA with SSL support. In the XA datasource descriptor you'll have to add: true Best regards, Stefan --- BaseDataSource.java Thu Apr 06 09:54:43 2006 +++ BaseDataSource.patched.java Thu Apr 06 09:51:39 2006 @@ -47,6 +47,7 @@ private String databaseName; private String user; private String password; + private boolean ssl = false; private int portNumber; private int prepareThreshold; private int loginTimeout; // in seconds @@ -262,13 +263,28 @@ } /** + * Is SSL enabled? + */ + public String isSsl() { + return ""+ssl; + } + + /** + * Enable or disable SSL. + * @param ssl enable or disable SSL. + */ + public void setSsl(String ssl) { + this.ssl = Boolean.valueOf(ssl).booleanValue(); + } + + /** * Generates a DriverManager URL from the other properties supplied. */ private String getUrl() { return "jdbc:postgresql://" + serverName + (portNumber == 0 ? "" : ":" + portNumber) + "/" + databaseName + - "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold; + "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold + (ssl?"&ssl=true":""); } /** @@ -301,6 +317,7 @@ ref.add(new StringRefAddr("prepareThreshold", Integer.toString(prepareThreshold))); ref.add(new StringRefAddr("loginTimeout", Integer.toString(loginTimeout))); + ref.add(new StringRefAddr("ssl", Boolean.toString(ssl))); return ref; } @@ -313,6 +330,7 @@ out.writeInt(portNumber); out.writeInt(prepareThreshold); out.writeInt(loginTimeout); + out.writeBoolean(ssl); } protected void readBaseObject(ObjectInputStream in) throws IOException, ClassNotFoundException @@ -324,6 +342,7 @@ portNumber = in.readInt(); prepareThreshold = in.readInt(); loginTimeout = in.readInt(); + ssl = in.readBoolean(); } }