Skip to content

Fix: forward Hikari data-source-properties to JDBC driver#11947

Open
itsmehotpants wants to merge 1 commit into
testcontainers:mainfrom
itsmehotpants:fix/1537-hikari-datasource-properties
Open

Fix: forward Hikari data-source-properties to JDBC driver#11947
itsmehotpants wants to merge 1 commit into
testcontainers:mainfrom
itsmehotpants:fix/1537-hikari-datasource-properties

Conversation

@itsmehotpants

Copy link
Copy Markdown

Fixes #1537.

createConnection() used new Properties(info), which chains info as default properties rather than copying its entries. Properties#getProperty() consults defaults, but raw Hashtable-style access (get, entrySet, keySet) - which many JDBC drivers use internally to enumerate connection args - does not. As a result, properties supplied via Hikari's data-source-properties (e.g. rewriteBatchedStatements, profileSQL) were silently dropped, with the only workaround being to stuff them into the JDBC URL query string instead.

Fix: switched to new Properties() + properties.putAll(info) so info's entries become real entries in the merged Properties object rather than just a defaults fallback.

Added a unit test (JdbcDatabaseContainerTest) with a fake capturing Driver that asserts the properties are visible via raw Hashtable access, not just getProperty() - which is what would have masked this bug in the first place.

createConnection() used 'new Properties(info)', which chains info as
*default* properties rather than copying its entries. Properties#getProperty()
consults defaults, but raw Hashtable-style access (get, entrySet, keySet) -
which many JDBC drivers use internally to enumerate connection args - does
not. As a result, properties supplied via Hikari's data-source-properties
(e.g. rewriteBatchedStatements, profileSQL) were silently dropped.

Switched to 'new Properties()' + 'putAll(info)' so info's entries become
real entries in the merged Properties object.

Fixes testcontainers#1537
@itsmehotpants
itsmehotpants requested a review from a team as a code owner July 24, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support hikari data-source-properties in ContainerDatabaseDriver

1 participant