Only set legacy flag when SSL is disabled.
@@ -85,11 +85,12 @@ public class PostgreSQLAuthenticationProviderModule implements Module {
if (sslMode != PostgreSQLSSLMode.PREFER)
driverProperties.setProperty("sslmode", sslMode.getDriverValue());
- // If SSL is enabled, check for and set other SSL properties.
- if (sslMode != PostgreSQLSSLMode.DISABLE) {
+ // If SSL is requested disabled, also set the legacy property.
+ if (sslMode == PostgreSQLSSLMode.DISABLE)
+ driverProperties.setProperty("ssl", "false");
- // Sets the legacy SSL configuration mode required by older servers.
- driverProperties.setProperty("ssl", "true");
+ // If SSL is enabled, check for and set other SSL properties.
+ else {
File sslClientCert = environment.getPostgreSQLSSLClientCertFile();
if (sslClientCert != null)
