diff options
-rw-r--r-- | org/madore/damlengine/WeblogDatabaseConnection.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/org/madore/damlengine/WeblogDatabaseConnection.java b/org/madore/damlengine/WeblogDatabaseConnection.java index b3e2690..5d3c8a2 100644 --- a/org/madore/damlengine/WeblogDatabaseConnection.java +++ b/org/madore/damlengine/WeblogDatabaseConnection.java @@ -102,12 +102,14 @@ public final class WeblogDatabaseConnection { final String dbUrl = "jdbc:postgresql://"+dbHost+":"+dbPort+"/"+dbName; final Properties dbProps = new Properties(); + final Driver drv = new Driver(); dbProps.setProperty("user", dbUser); dbProps.setProperty("password", dbPass); dbProps.setProperty("ssl", "true"); - dbProps.setProperty("sslmode", "prefer"); + if ( drv.getMajorVersion() >= 42 ) + dbProps.setProperty("sslmode", "prefer"); dbProps.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); - conn = (new Driver()).connect(dbUrl, dbProps); + conn = drv.connect(dbUrl, dbProps); conn.createStatement().execute("SET TIME ZONE 0"); pconn.set(conn); } |