Skip to content

Commit 48cd465

Browse files
committed
Set Oracle connection props on OracleDataSource instead of connection url
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
1 parent 47eb6dc commit 48cd465

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

vertx-oracle-client/src/main/java/io/vertx/oracleclient/impl/OracleDatabaseHelper.java

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,22 @@ private static String composeJdbcUrl(OracleConnectOptions options) {
7676
}
7777
}
7878
}
79-
Map<String, String> properties = options.getProperties();
80-
if (properties != null && !properties.isEmpty()) {
81-
url.append("?");
82-
boolean first = true;
83-
for (Map.Entry<String, String> entry : properties.entrySet()) {
84-
if (first) {
85-
first = false;
86-
} else {
87-
url.append("&");
88-
}
89-
url.append(encodeUrl(entry.getKey())).append("=").append(encodeUrl(entry.getValue()));
90-
}
91-
}
9279
return url.toString();
9380
}
9481

9582
/**
9683
* Configures an {@code OracleDataSource}.
9784
*
9885
* @param oracleDataSource An data source to configure
99-
* @param options OracleConnectOptions options. Not null.
86+
* @param options OracleConnectOptions options. Not null.
10087
*/
101-
private static void configureStandardOptions(
102-
OracleDataSource oracleDataSource, OracleConnectOptions options) {
88+
private static void configureStandardOptions(OracleDataSource oracleDataSource, OracleConnectOptions options) {
89+
Map<String, String> properties = options.getProperties();
90+
if (properties != null && !properties.isEmpty()) {
91+
for (Map.Entry<String, String> entry : properties.entrySet()) {
92+
runOrHandleSQLException(() -> oracleDataSource.setConnectionProperty(entry.getKey(), entry.getValue()));
93+
}
94+
}
10395

10496
String user = options.getUser();
10597
if (user != null) {
@@ -108,16 +100,13 @@ private static void configureStandardOptions(
108100

109101
CharSequence password = options.getPassword();
110102
if (password != null) {
111-
runOrHandleSQLException(() ->
112-
oracleDataSource.setPassword(password.toString()));
103+
runOrHandleSQLException(() -> oracleDataSource.setPassword(password.toString()));
113104
}
114105

115106
int connectTimeout = options.getConnectTimeout();
116107
if (connectTimeout > 0) {
117-
runOrHandleSQLException(() ->
118-
oracleDataSource.setLoginTimeout(connectTimeout));
108+
runOrHandleSQLException(() -> oracleDataSource.setLoginTimeout(connectTimeout));
119109
}
120-
121110
}
122111

123112
private static void configureExtendedOptions(

0 commit comments

Comments
 (0)