java/sql-dk/src/info/globalcode/sql/dk/configuration/Loader.java
branchv_0
changeset 236 a3ec71fa8e17
parent 196 76da38d49e81
--- 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!");
 		}