@@ -57,12 +57,18 @@ public Connection connect(String url, Properties props) throws SQLException {
57
57
return null ;
58
58
}
59
59
try {
60
+ // Load properties from the URL and from getConnection()'s properties.
61
+ // URL properties take precedence.
62
+ Properties properties = new Properties ();
63
+ properties .putAll (props ); // via getConnection()
64
+ properties .putAll (ConnectStringParser .parse (url .substring (getConnectStringPrefix ().length ())));
65
+
60
66
if (prepareFactory == null ) {
61
67
// funky way of extending Driver with a custom Prepare:
62
- return withPrepareFactory (() -> new Prepare (props ))
63
- .connect (url , props );
68
+ return withPrepareFactory (() -> new Prepare (properties ))
69
+ .connect (url , properties );
64
70
}
65
- Connection connection = super .connect (url , props );
71
+ Connection connection = super .connect (url , properties );
66
72
if (connection == null ) {
67
73
throw new IOException ("Could not connect to " + url );
68
74
}
@@ -76,12 +82,6 @@ public Connection connect(String url, Properties props) throws SQLException {
76
82
calciteConnection .setSchema ("DEFAULT" );
77
83
78
84
WrappedSchemaPlus wrappedRootSchema = new WrappedSchemaPlus (rootSchema );
79
-
80
- // Load properties from the URL and from getConnection()'s properties.
81
- // URL properties take precedence.
82
- Properties properties = new Properties ();
83
- properties .putAll (props ); // via getConnection()
84
- properties .putAll (ConnectStringParser .parse (url .substring (getConnectStringPrefix ().length ())));
85
85
String [] catalogs = properties .getProperty ("catalogs" , "" ).split ("," );
86
86
87
87
if (catalogs .length == 0 || catalogs [0 ].length () == 0 ) {
@@ -92,7 +92,7 @@ public Connection connect(String url, Properties props) throws SQLException {
92
92
} else {
93
93
// load specific catalogs when loaded as `jdbc:hoptimator://catalogs=foo,bar`
94
94
for (String catalog : catalogs ) {
95
- CatalogService .catalog (catalog ).register (wrappedRootSchema , props );
95
+ CatalogService .catalog (catalog ).register (wrappedRootSchema , properties );
96
96
}
97
97
}
98
98
@@ -104,7 +104,7 @@ public Connection connect(String url, Properties props) throws SQLException {
104
104
105
105
@ Override
106
106
public Driver withPrepareFactory (Supplier <CalcitePrepare > prepareFactory ) {
107
- return new HoptimatorDriver (prepareFactory );
107
+ return new HoptimatorDriver (prepareFactory );
108
108
}
109
109
110
110
public static class Prepare extends CalcitePrepareImpl {
0 commit comments