# HG changeset patch # User František Kučera # Date 1551201589 -3600 # Node ID a3ec71fa8e17c613d6870546d912c3fffac103f9 # Parent 8ce612cca4d88a1c49b742cc8fc130adb243a0ae Avoid reusing/rewriting the DB connection properties. There was weird random errors while testing connection to multiple DB in parallel when one of them was meta connection to same DB connection. Two kinds of exception: 1) missing password 2) „Passing DB password as CLI parameter is insecure!“ diff -r 8ce612cca4d8 -r a3ec71fa8e17 java/sql-dk/src/info/globalcode/sql/dk/configuration/Loader.java --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/Loader.java Tue Feb 26 17:31:41 2019 +0100 +++ b/java/sql-dk/src/info/globalcode/sql/dk/configuration/Loader.java Tue Feb 26 18:19:49 2019 +0100 @@ -58,6 +58,13 @@ * @throws java.sql.SQLException */ public static Connection jdbcConnect(DatabaseDefinition databaseDefinition, Properties properties) throws SQLException { + synchronized (properties) { + /** + * Avoid rewriting the properties. Usually, the connection is created only once, but + * with --test-connection and with SQL-DK JDBC driver, it might be reused. + */ + properties = properties.clone(); + } if (properties.hasProperty(JDBC_PROPERTY_PASSWORD)) { log.log(Level.WARNING, "Passing DB password as CLI parameter is insecure!"); }