-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Support in DevServices for additional JDBC URL parameters #15579
Comments
I don't know if it would make sense to parse the JDBC URL config property for the datasource and extract the URL parameters from that or whether there should be another dedicated DevServices config property for this. I am thinking it might be nice if the URL parameters would be extracted by default and could be overridden if necessary. |
/cc @stuartwdouglas @gsmet maybe "DevServices" should trigger some labels, e.g. |
There needs to be a dedicated property for this, if devservices is in use then there is no URL to parse (as the presence of a URL will stop devservices starting) |
I see. I hadn't quite understood yet that this is how devservices is activated. Thanks for the clarification. |
As commented on the PR, I believe the implementation for MSSQL needs some minor adjustment. |
Description
The DevServices feature currently doesn't yet support setting additional URL parameters for the created database. Some database (like Oracle and MySQL for example) allow specifying various parameters (e.g. time zone) as JDBC URL parameters. Currently the JDBC URL will be constructed by Testcontainers, so to specify URL parameters the Dev Service would have to call
org.testcontainers.containers.JdbcDatabaseContainer#withUrlParam()
.Currently
DevServicesDatasourceProvider#startDatabase()
declares a parameterMap<String, String> additionalProperties
. I am however not quite sure about the intended purpose of this parameter. While Testcontainers currently doesn't support specifying parameters (which would be passed tojava.sql.Driver#connect(String, Properties)
), this isn't really necessary either, because Dev Services doesn't delegate the Connection creation to Testcontainers, only the JDBC URL creation.Implementation ideas
Possibly the
Map<String, String> additionalProperties
parameter could be (renamed and) repurposed. Or if I have misunderstood its purpose, possibly a new parameter could be introduced which would allow specifying additional JDBC URL parameters.The text was updated successfully, but these errors were encountered: