Skip to content
This repository has been archived by the owner on Sep 21, 2018. It is now read-only.

Commit

Permalink
Disable useSSL query param for Oracle/SQL Server modules
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorth committed Jan 30, 2018
1 parent adc352c commit c3e1328
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.testcontainers.containers;

import org.rnorth.ducttape.unreliables.Unreliables;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

/**
* @author Stefan Hufschmidt
*/
Expand Down Expand Up @@ -55,4 +63,21 @@ public String getPassword() {
public String getTestQueryString() {
return "SELECT 1";
}

// TODO: Replace with permanent solution to https://github.com/testcontainers/testcontainers-java/issues/568
@Override
public Connection createConnection(String queryString) throws SQLException {
final Properties info = new Properties();
info.put("user", this.getUsername());
info.put("password", this.getPassword());
final String url = this.getJdbcUrl() + queryString;

final Driver jdbcDriverInstance = getJdbcDriverInstance();

try {
return Unreliables.retryUntilSuccess(120, TimeUnit.SECONDS, () -> jdbcDriverInstance.connect(url, info));
} catch (Exception e) {
throw new SQLException("Could not create new connection", e);
}
}
}

0 comments on commit c3e1328

Please sign in to comment.