-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add getR2dbcUrl helper method to JdbcDatabaseContainer #8797
Comments
|
@linghengqian I do not understand your point at all. R2DBC is a spec. It is a spec. The format of such URL is predefined for each implementation. Therefore, it does not matter whether one RDBMS has 0, 1 or multiple R2DBC drivers - they still will comply to the standard. I think adding this is utterly clear and portable, in contrast to example with JDBC URL which is not standardized by a single spec. If we care about the user, who is trying to get R2DBC URL for the database, which actually does not have the R2DBC driver - who's fault that actually is? |
Hi, thanks for the suggestion. I don't think this is feasible nowadays, the change must be done in R2DBCDatabaseContainer. But, it would be used Testcontainers R2dbc integrations in spring-boot and micronaut test-resources are based on Other alternative is to implement |
|
I honestly do not understand how the case for comparison of Apart from that, solving this issue does not seem to be that complicated (but I might be wrong). However, it is indeed a bit of shame that so much time spent for discussion and arguments for such a small feature. |
The Testcontainers team has no negative sentiment towards R2DBC and no opinion with regards to its future direction. We aren't not opposed to the feature request from a user perspective at all, we just need to agree on the design/API. For me it sounds like it could be possible to implement
@eddumelendez Maybe you can elaborate why it would not be feasible with the current design? |
I took another look and the following method can be provided Example using public static String getR2dbcUrl(MSSQLServerContainer<?> container) {
ConnectionFactoryOptions options = getOptions(container);
return String.format("...", options.getValue(Option.valueOf("")));
} every
I would like to enforce the implementation by declaring the method in the interface but more breaking changes would be require. I think the suggestion above will cover the current need. |
We could implement the method @mipo256 For your use case, is having this method on |
We have agreed on adding a new static method on each For example, under public static String getR2dbcUrl(MySQLContainer<?> container) {
return ...;
} Current users used to do Please free free to submit a PR. |
submit a PR #9569 |
Module
Core
Problem
I might've been chosen the wrong module, sorry for that, haven't found one for all RDBMS containers.
There is a convenient method,
getJdbcUrl
inJdbcDatabaseContainer
. The problem however, if I'm working with R2DBC the connection string schema is different. Currently, I have to create an R2DBC connection string myself, which is a bit tedious.Solution
It would be great to have a similar method in
JdbcDatabaseContainer
, likegetR2dbcUrl
that would construct the R2DBC compliant connection string.Benefit
This would make integration with R2DBC drivers more seamless and provide better developer experience.
Alternatives
The alternative, I think, is to create the connection string manually, which might be fine, not a big deal, until you have to do it over and over again, in which case it became really frustrating.
Would you like to help contributing this feature?
Yes
The text was updated successfully, but these errors were encountered: