From d2d57b5cb65061a0fcfc7c59ab592bdf99b6e13a Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Wed, 7 Oct 2020 19:55:21 +0200 Subject: Previous commit makes old versions fail. Fix this. --- org/madore/damlengine/WeblogDatabaseConnection.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'org') 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); } -- cgit v1.2.3