diff src/main/java/org/monetdb/jdbc/MonetDriver.java @ 809:aa4108a5bc34 monetdbs

Move more URL and properties parsing responsibilities to Target
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Tue, 12 Dec 2023 12:03:24 +0100 (16 months ago)
parents 04a27386789f
children 5aa19bbed0d6
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetDriver.java
+++ b/src/main/java/org/monetdb/jdbc/MonetDriver.java
@@ -106,31 +106,12 @@ public final class MonetDriver implement
 		if (!acceptsURL(url))
 			return null;
 
-		Target target = new Target();
-
 		try {
-			// If properties are given, add those first
-			if (info != null) {
-				for (String key : info.stringPropertyNames()) {
-					String value = info.getProperty(key);
-					if (key.equals(Parameter.HOST.name))
-						value = Target.unpackHost(value);
-					target.setString(key, value);
-				}
-			}
-
-			// If url is exactly "jdbc:monetdb:", use just the properties.
-			// This is different from, say, jdbc:monetdb://, because the
-			// latter will clear preexisting host, port, TLS and database settings.
-			// Useful in combination with Target.toProperties().
-			if (!url.equals("jdbc:monetdb:"))
-				MonetUrlParser.parse(target, url.substring(5));
+			Target target = new Target(url, info);
+			return new MonetConnection(target);
 		} catch (ValidationError | URISyntaxException e) {
 			throw new SQLException(e.getMessage());
 		}
-
-        // finally return the Connection object as requested
-		return new MonetConnection(target);
 	}
 
 	/**