Skip to content

Commit a1c3728

Browse files
authored
Fix derby directory connection string parser (#12479)
1 parent 8635be6 commit a1c3728

File tree

2 files changed

+251
-72
lines changed

2 files changed

+251
-72
lines changed

instrumentation/jdbc/library/src/main/java/io/opentelemetry/instrumentation/jdbc/internal/JdbcConnectionUrlParser.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,12 @@ DbInfo.Builder doParse(String jdbcUrl, DbInfo.Builder builder) {
752752
builder.subtype("directory").host(null).port(null);
753753
String urlInstance = details.substring("directory:".length());
754754
if (!urlInstance.isEmpty()) {
755-
instance = urlInstance;
755+
int dbNameStartLocation = urlInstance.lastIndexOf('/');
756+
if (dbNameStartLocation != -1) {
757+
instance = urlInstance.substring(dbNameStartLocation + 1);
758+
} else {
759+
instance = urlInstance;
760+
}
756761
}
757762
} else if (details.startsWith("classpath:")) {
758763
builder.subtype("classpath").host(null).port(null);

0 commit comments

Comments
 (0)