summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2020-10-07 19:55:21 +0200
committerDavid A. Madore <david+git@madore.org>2020-10-07 19:55:21 +0200
commitd2d57b5cb65061a0fcfc7c59ab592bdf99b6e13a (patch)
treea19acea210e515e384aeba5eaaf3d30ce5fad78e
parent21cc6af91980b7ebc4de9f2ac1b5f09c5b8748d9 (diff)
downloaddamlengine-d2d57b5cb65061a0fcfc7c59ab592bdf99b6e13a.tar.gz
damlengine-d2d57b5cb65061a0fcfc7c59ab592bdf99b6e13a.tar.bz2
damlengine-d2d57b5cb65061a0fcfc7c59ab592bdf99b6e13a.zip
Previous commit makes old versions fail. Fix this.
-rw-r--r--org/madore/damlengine/WeblogDatabaseConnection.java6
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);
}