Skip to content

Commit

Permalink
Fixes #1137 support changing user/password at runtime for DriverDataS…
Browse files Browse the repository at this point in the history
…ource-wrapped driver connections.
  • Loading branch information
brettwooldridge committed May 14, 2018
1 parent 71e8688 commit 851e2d4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/com/zaxxer/hikari/util/DriverDataSource.java
Expand Up @@ -120,9 +120,18 @@ public Connection getConnection() throws SQLException
}

@Override
public Connection getConnection(String username, String password) throws SQLException
public Connection getConnection(final String username, final String password) throws SQLException
{
return getConnection();
final Properties cloned = (Properties) driverProperties.clone();
if (username != null) {
cloned.put("user", username);
cloned.put("username", username);
}
if (password != null) {
cloned.put("password", password);
}

return driver.connect(jdbcUrl, cloned);
}

@Override
Expand Down

0 comments on commit 851e2d4

Please sign in to comment.