-
-
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
MySQL SSL parameters in URI are ignored #374
Comments
I didn't get the warning when running our |
The project is based on Spring Boot, so everything is autoconfigured. I use |
Can you share an example project? Might have something to do with the way Spring-Boot parses the JDBC-Url, it might be confused by the TC parameter, not sure though. Maybe #345 plays into this issue as well. |
It might be related to how waitUntilContainerStarted() is implemented in JdbcDatabaseContainer. It uses a createConnection("") and as such it has no queryString. But then again that warning should come in the beginning. Right after container startup and not after execution of any scripts. |
I'm seeing the same thing, but as npetzall says - it's down to the implementation of waitUntilContainerStarted(). If you set up some tests with a rule like this:
Then you'll see it logged before every test. E.g. this test that doesn't even use the container will log the warning:
|
A really dirty way of removing the error is using an older mysql-connector-java. Since it's a message from the driver. |
I think testcontainer should add |
Am I right in that now any subclass of Jdbc Container get useSSL=false which might be a vendor specific argument? So I need to validate that all my jdbc drivers won't freakout if useSSL=false is supplied as a query string? What about withDefaultQueryString and an overloaded getConnection() that uses default? Then in mysql just set it in the constructor an if you want to remove just supply empty string/null to withDefaultQueryString. |
I thought about this. But as all current tests passed I assumed that at least currently supported containers work just fine with it. If some DB fails on this, I will be happy to investigate more elaborate solution. |
I understand your point, but due to change in superclass it literally affects all jdbc drivers in the universe that can be used with testcontainers. Writing a new or custom(informix, hive, impala) Everything is not lost, it's a simple override. |
I just have vague recollection of oracle jdbc drivers not keen on unsupported query strings. |
It would probably be good to either mark JdbcContainer as internal or public api. Since with that information you either need to take consumer/user subclasses into account or just your own. If it would be marked as internal and my informix subclass would fail, well that's all on me for using an internal api (you only need to verify your usage and not take anyone else's into account), if it was public and it changed how it talks to all jdbc driver I would consider it a possible breaking change, major version bump and all that. Hypothetical it could have worked with oracle and SQL server but not with informix, hive, impala, firebird, db2, netezza..... |
Well, it seems I have to solve it properly :) I will propose a new PR in the next week. |
As a side-note the separator Add
to JdbcDatabaseContainer Change JdbcDatabaseContainer.createConnection(String queryString) Change JdbcDatabaseContainer.waitUntilContainerStarted() Add This is after revert of #561 and it would allow others to customize the check connection which might be desirable in user subclasses. |
@rnorth I think the suggestions of @npetzall above make total sense. If they are implemented, then this issue #374 will be solved, #568 will not occur. Then #345 can be solved just by stripping all parameters from But with your approval I can make them. |
When using TC jdbc URL you don't have access to the container so you won't be able to set the parameters. |
Hm, but then what exactly |
Proposal was written moments before the PR. The proposal allows for setting the waitForContainerStart queryString without subclassing and without any duplicate check. The not subclassing is nice, also I could declare the queryString only once in default and call connect with null. Only interesting if multiple connections are required and the jdbc implementation allows multiple connections too single thread. |
Hi all!
After executing my own sql script MySQL TestContainer outputs the next warning:
It's a well known issue so I've tried to use the next URIs:
jdbc:tc:mysql://hostname/databasename?TC_INITSCRIPT=initial_sql.sql&useSSL=false
jdbc:tc:mysql://hostname/databasename?TC_INITSCRIPT=initial_sql.sql&autoReconnect=true&useSSL=false
jdbc:tc:mysql://hostname/databasename?TC_INITSCRIPT=initial_sql.sql&verifyServerCertificate=false&useSSL=true
But neither of them worked and the warning still occurs.
I'm wondering, as soon as hostname and database name are ignored, maybe all these ssl settings are ignored too? And is there a way to define them in another way?
Would appreciate any help, thanks.
The text was updated successfully, but these errors were encountered: