Skip to content

Commit 9d5dbd6

Browse files
authored
Change config loading order to give URLs precedence (#103)
1 parent a15f08f commit 9d5dbd6

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

hoptimator-jdbc/src/main/java/com/linkedin/hoptimator/jdbc/HoptimatorDriver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public Connection connect(String url, Properties props) throws SQLException {
7777

7878
WrappedSchemaPlus wrappedRootSchema = new WrappedSchemaPlus(rootSchema);
7979

80-
// Load properties from url and from getConnection()
80+
// Load properties from the URL and from getConnection()'s properties.
81+
// URL properties take precedence.
8182
Properties properties = new Properties();
8283
properties.putAll(props); // via getConnection()
8384
properties.putAll(ConnectStringParser.parse(url.substring(getConnectStringPrefix().length())));

hoptimator-kafka/src/main/java/com/linkedin/hoptimator/kafka/KafkaDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public Connection connect(String url, Properties props) throws SQLException {
3535
return null;
3636
}
3737
Properties properties = new Properties();
38-
properties.putAll(ConnectStringParser.parse(url.substring(getConnectStringPrefix().length())));
3938
properties.putAll(props); // in case the driver is loaded via getConnection()
39+
properties.putAll(ConnectStringParser.parse(url.substring(getConnectStringPrefix().length())));
4040
try {
4141
Connection connection = super.connect(url, props);
4242
if (connection == null) {

hoptimator-venice/src/main/java/com/linkedin/hoptimator/venice/VeniceDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public Connection connect(String url, Properties props) throws SQLException {
3939
}
4040
// Connection string properties are given precedence over config properties
4141
Properties properties = new Properties();
42-
properties.putAll(ConnectStringParser.parse(url.substring(getConnectStringPrefix().length())));
4342
properties.putAll(props); // in case the driver is loaded via getConnection()
43+
properties.putAll(ConnectStringParser.parse(url.substring(getConnectStringPrefix().length())));
4444
String cluster = properties.getProperty("cluster");
4545
if (cluster == null) {
4646
throw new IllegalArgumentException("Missing required cluster property. Need: jdbc:venice://cluster=...");

0 commit comments

Comments
 (0)