Skip to content

Commit

Permalink
Pass string
Browse files Browse the repository at this point in the history
  • Loading branch information
girarda committed Feb 22, 2022
1 parent 4dbb749 commit 6978217
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
28 changes: 28 additions & 0 deletions airbyte-db/lib/src/main/java/io/airbyte/db/Databases.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ public static Database createDatabase(final String username,
return new Database(connectionPool, dialect);
}

public static Database createDatabase(final String username,
final String password,
final String jdbcConnectionString,
final String driverClassName,
final SQLDialect dialect,
final String connectionProperties) {
final BasicDataSource connectionPool =
createBasicDataSource(username, password, jdbcConnectionString, driverClassName, connectionProperties);

return new Database(connectionPool, dialect);
}

public static JdbcDatabase createJdbcDatabase(final String username,
final String password,
final String jdbcConnectionString,
Expand Down Expand Up @@ -213,6 +225,22 @@ public static BasicDataSource createBasicDataSource(final String username,
return connectionPool;
}

public static BasicDataSource createBasicDataSource(final String username,
final String password,
final String jdbcConnectionString,
final String driverClassName,
final String connectionProperties) {
final BasicDataSource connectionPool = new BasicDataSource();
connectionPool.setDriverClassName(driverClassName);
connectionPool.setUsername(username);
connectionPool.setPassword(password);
connectionPool.setInitialSize(0);
connectionPool.setMaxTotal(5);
connectionPool.setUrl(jdbcConnectionString);
connectionPool.setConnectionProperties(connectionProperties);
return connectionPool;
}

public static BigQueryDatabase createBigQueryDatabase(final String projectId, final String jsonCreds) {
return new BigQueryDatabase(projectId, jsonCreds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableMap;
import io.airbyte.commons.io.IOs;
import io.airbyte.commons.json.Jsons;
import io.airbyte.commons.string.Strings;
Expand Down Expand Up @@ -142,8 +141,7 @@ protected Database getDatabase() {
baseConfig.get("port").asText(),
baseConfig.get("database").asText()),
"com.amazon.redshift.jdbc.Driver", null,
ImmutableMap.of("ssl", "true", "sslfactory", "com.amazon.redshift.ssl.NonValidatingFactory")
);
"ssl=true;sslfactory=com.amazon.redshift.ssl.NonValidatingFactory");
}

@Override
Expand Down

0 comments on commit 6978217

Please sign in to comment.