java/sql-dk/src/info/globalcode/sql/dk/configuration/Loader.java
branchv_0
changeset 236 a3ec71fa8e17
parent 196 76da38d49e81
equal deleted inserted replaced
235:8ce612cca4d8 236:a3ec71fa8e17
    56 	 * @param databaseDefinition
    56 	 * @param databaseDefinition
    57 	 * @return
    57 	 * @return
    58 	 * @throws java.sql.SQLException
    58 	 * @throws java.sql.SQLException
    59 	 */
    59 	 */
    60 	public static Connection jdbcConnect(DatabaseDefinition databaseDefinition, Properties properties) throws SQLException {
    60 	public static Connection jdbcConnect(DatabaseDefinition databaseDefinition, Properties properties) throws SQLException {
       
    61 		synchronized (properties) {
       
    62 			/**
       
    63 			 * Avoid rewriting the properties. Usually, the connection is created only once, but
       
    64 			 * with --test-connection and with SQL-DK JDBC driver, it might be reused.
       
    65 			 */
       
    66 			properties = properties.clone();
       
    67 		}
    61 		if (properties.hasProperty(JDBC_PROPERTY_PASSWORD)) {
    68 		if (properties.hasProperty(JDBC_PROPERTY_PASSWORD)) {
    62 			log.log(Level.WARNING, "Passing DB password as CLI parameter is insecure!");
    69 			log.log(Level.WARNING, "Passing DB password as CLI parameter is insecure!");
    63 		}
    70 		}
    64 		Properties credentials = new Properties();
    71 		Properties credentials = new Properties();
    65 		credentials.add(new Property(JDBC_PROPERTY_USER, databaseDefinition.getUserName()));
    72 		credentials.add(new Property(JDBC_PROPERTY_USER, databaseDefinition.getUserName()));