testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

Merge caller JDBC Properties in createConnection

Open singhvishalkr opened this issue 6 months ago • 1 comments

What is the purpose of your change?

Hikari and other pools pass URL-level options through the \info\ map on \Driver.connect. Those entries must show up on the same \Properties\ instance we hand to the delegate driver, together with the container username and password.

Using
ew Properties(info)\ keeps caller keys on the defaults list. Drivers that only inspect the primary map (or build cache keys from \stringPropertyNames()\ without merging defaults the way you expect) effectively drop those options.

How does it work?

Start from an empty \Properties, \putAll\ the caller map when \info\ is non-null, then put \user\ and \password\ as today. Added a unit test with a mock \Driver\ that asserts a sample caller key is present in \stringPropertyNames()\ after the merge.

Fixes #1537.

Note: I could not run ./gradlew spotlessApply\ locally (no JDK in this environment). Please rely on CI for Spotless and the jdbc test task.

singhvishalkr avatar May 09 '26 11:05 singhvishalkr

Visibility ping: ready to address comments whenever reviewers post them.

singhvishalkr avatar May 18 '26 18:05 singhvishalkr