Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change config loading order to give URLs precedence #103

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

ryannedolan
Copy link
Collaborator

Summary

Change config loading order in JDBC drivers to consistently give URL properties precedence over getConnection()'s properties.

Details

JDBC drivers may be loaded via the older DriverManager mechanism or via the newer DataSource mechanism. With the former, drivers may be loaded as getConnection(url, props), where props are optional connection properties. The URL itself very often includes connection properties, raising the question of which source of properties takes precdence.

The JDBC docs do not specify what should happen here, explicitly leaving it to the drivers to decide.

Given that end users can often only control and see the URL, we think it makes sense to given the URL precedence here. In that case, the props supplied to getConnection() should be considered defaults rather than overrides.

The opposite approach would yield surprising behavior, when e.g. a log showed jdbc:foo://bar=qux while the driver silently overwrote bar.

Testing

None. Integration tests should cover this trivial change.

@ryannedolan ryannedolan enabled auto-merge (squash) February 10, 2025 21:20
@ryannedolan ryannedolan merged commit 9d5dbd6 into main Feb 11, 2025
1 check passed
@ryannedolan ryannedolan deleted the switch-config-loading-order branch February 11, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants