Skip to content

Commit

Permalink
Added H2 connection target
Browse files Browse the repository at this point in the history
  • Loading branch information
witx98 committed Nov 23, 2024
1 parent 4bb1b81 commit 4b6039e
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ public H2Connection(DatabaseMetaData metaData, DataSource dataSource) {
super(dataSource, TEST_QUERY);
try {
this.url = metaData.getURL();
int slashIndex = url.lastIndexOf('/');
int to = url.length();
if (url.lastIndexOf("?") != -1) {
to = url.lastIndexOf("?");
}
this.target = url.substring(slashIndex + 1, to).toLowerCase(Locale.ROOT);
int colonIndex = url.lastIndexOf(':');
this.target = url.substring(colonIndex + 1).toLowerCase(Locale.ROOT);
this.dbVendor = metaData.getDatabaseProductName();
log.info("H2 info: target: {}, url: {}, dbVendor: {}", target, url, dbVendor);
} catch (SQLException e) {
log.warn("Error getting db information", e);
this.target = "ERROR";
Expand Down

0 comments on commit 4b6039e

Please sign in to comment.