diff -c -d -r pgjdbc.orig/doc/pgjdbc.xml pgjdbc/doc/pgjdbc.xml *** pgjdbc.orig/doc/pgjdbc.xml 2007-07-24 16:22:01.000000000 +0200 --- pgjdbc/doc/pgjdbc.xml 2007-07-25 13:23:04.000000000 +0200 *************** *** 2671,2676 **** --- 2671,2694 ---- + ssl + boolean + + If true, use SSL encrypted connections + (default false) + + + + + sslfactory + String + + Custom javax.net.ssl.SSLSocketFactory + class name (see ) + + + + defaultAutoCommit boolean *************** *** 2810,2815 **** --- 2828,2851 ---- String Password used to make database connections + + + ssl + boolean + + If true, use SSL encrypted connections + (default false) + + + + + sslfactory + String + + Custom javax.net.ssl.SSLSocketFactory + class name (see ) + + diff -c -d -r pgjdbc.orig/org/postgresql/ds/common/BaseDataSource.java pgjdbc/org/postgresql/ds/common/BaseDataSource.java *** pgjdbc.orig/org/postgresql/ds/common/BaseDataSource.java 2007-07-24 16:22:01.000000000 +0200 --- pgjdbc/org/postgresql/ds/common/BaseDataSource.java 2007-07-25 09:57:50.000000000 +0200 *************** *** 49,54 **** --- 49,56 ---- private int portNumber; private int prepareThreshold; private int loginTimeout; // in seconds + private boolean ssl = false; + private String sslfactory; /** * Gets a connection to the PostgreSQL database. The database is identified by the *************** *** 261,273 **** } /** * Generates a DriverManager URL from the other properties supplied. */ private String getUrl() { return "jdbc:postgresql://" + serverName + (portNumber == 0 ? "" : ":" + portNumber) + "/" + databaseName + ! "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold; } /** --- 263,320 ---- } /** + * Set whether the connection will be SSL encrypted or not. + * + * @param enabled if true, connect with SSL. + */ + public void setSsl(boolean enabled) + { + this.ssl = enabled; + } + + /** + * Gets SSL encryption setting. + * + * @return true if connections will be encrypted with SSL. + */ + public boolean getSsl() + { + return this.ssl; + } + + /** + * Set the name of the {@link javax.net.ssl.SSLSocketFactory} to use for connections. + * Use org.postgresql.ssl.NonValidatingFactory if you don't want certificate validation. + * + * @param classname name of a subclass of javax.net.ssl.SSLSocketFactory or null for the default implementation. + */ + public void setSslfactory(String classname) + { + this.sslfactory = classname; + } + + /** + * Gets the name of the {@link javax.net.ssl.SSLSocketFactory} used for connections. + * + * @return name of the class or null if the default implementation is used. + */ + public String getSslfactory() + { + return this.sslfactory; + } + + /** * Generates a DriverManager URL from the other properties supplied. */ private String getUrl() { return "jdbc:postgresql://" + serverName + (portNumber == 0 ? "" : ":" + portNumber) + "/" + databaseName + ! "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold + ! (this.ssl ! ? "&ssl" + ((null != this.sslfactory) ? "&sslfactory=" + this.sslfactory : "") ! : "" ! ); } /**