Skip to content

Commit 86718b1

Browse files
committed
Merge branch 'issue-374' of https://github.com/iNikem/testcontainers-java into iNikem-issue-374
2 parents 5ca3235 + 0e760f9 commit 86718b1

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
1212
- Environment variables are now stored as Map instead of List ([\#550](https://github.com/testcontainers/testcontainers-java/pull/550))
1313
- Added `withEnv(String name, Function<Optional<String>, String> mapper)` with optional previous value ([\#550](https://github.com/testcontainers/testcontainers-java/pull/550))
1414
- Added `withFileSystemBind` overloaded method with `READ_WRITE` file mode by default ([\#550](https://github.com/testcontainers/testcontainers-java/pull/550))
15+
- All connections to JDBC containers (e.g. MySQL) don't use SSL anymore. ([\#374](https://github.com/testcontainers/testcontainers-java/issues/374))
1516

1617
## [1.5.1] - 2017-12-19
1718

modules/jdbc-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>mysql</groupId>
4444
<artifactId>mysql-connector-java</artifactId>
45-
<version>5.1.35</version>
45+
<version>5.1.45</version>
4646
<scope>test</scope>
4747
</dependency>
4848
<dependency>

modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public Connection createConnection(String queryString) throws SQLException {
136136
final Properties info = new Properties();
137137
info.put("user", this.getUsername());
138138
info.put("password", this.getPassword());
139-
final String url = this.getJdbcUrl() + queryString;
139+
final String url = appendDisableSslConfig(this.getJdbcUrl() + queryString);
140140

141141
final Driver jdbcDriverInstance = getJdbcDriverInstance();
142142

@@ -147,6 +147,11 @@ public Connection createConnection(String queryString) throws SQLException {
147147
}
148148
}
149149

150+
private String appendDisableSslConfig(String connectionString){
151+
String separator = connectionString.contains("?") ? "&" : "?";
152+
return connectionString + separator + "useSSL=false";
153+
}
154+
150155
protected void optionallyMapResourceParameterAsVolume(@NotNull String paramName, @NotNull String pathNameInContainer, @NotNull String defaultResource) {
151156
String resourceName = parameters.getOrDefault(paramName, defaultResource);
152157

0 commit comments

Comments
 (0)