Skip to content

Commit

Permalink
Merge pull request #13 from rchodava/issue-12
Browse files Browse the repository at this point in the history
Allow creating DB clients with just a connection URL, and no username/password
  • Loading branch information
rchodava committed Mar 13, 2016
2 parents 4922857 + c0dbbbf commit ee078ce
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public DatabaseClient(DataSource dataSource) {
this.password = null;
}

public DatabaseClient(String url) {
this(url, null, null);
}

public DatabaseClient(String url, String username, String password) {
this.dataSource = null;

Expand All @@ -46,7 +50,7 @@ private Database getDatabase() {
if (dataSource != null) {
connectionProvider = new DelegatingConnectionProvider(new ConnectionProviderFromDataSource(dataSource));
database = Database.from(connectionProvider);
} else if (url != null && username != null && password != null) {
} else if (url != null) {
connectionProvider = new DelegatingConnectionProvider(new ConnectionProviderFromUrl(url, username, password));
database = Database.from(connectionProvider);
}
Expand Down

0 comments on commit ee078ce

Please sign in to comment.