Re: do XA connections support SSL?
От | Stefan Verkoyen |
---|---|
Тема | Re: do XA connections support SSL? |
Дата | |
Msg-id | 4434CB81.8000909@quesd.com обсуждение исходный текст |
Ответ на | Re: do XA connections support SSL? (Kris Jurka <books@ejurka.com>) |
Список | pgsql-jdbc |
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: <xa-datasource-property name="Ssl">true</xa-datasource-property> 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(); } }
В списке pgsql-jdbc по дате отправления: