Skip to content

Commit 5b7f678

Browse files
author
Zhen Li
committed
Normalize database name to lowercase on client to avoid creating multiple routing tables for the same database
1 parent 97b1532 commit 5b7f678

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

driver/src/main/java/org/neo4j/driver/SessionConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ public Builder withDatabase( String database )
229229
// Disallow users to use bolt internal value directly. To users, this is totally an illegal database name.
230230
throw new IllegalArgumentException( String.format( "Illegal database name '%s'.", database ) );
231231
}
232-
this.database = database;
232+
// The database name is normalized to lowercase on the server side.
233+
// The client in theory shall not perform any normalization at all.
234+
// However as this name is also used in routing table registry as the map's key to find the routing table for the given database,
235+
// to avoid multiple routing tables for the same database, we perform a client side normalization.
236+
this.database = database.toLowerCase();
233237
return this;
234238
}
235239

0 commit comments

Comments
 (0)