Exposing SSL-only version of MySQL Source (#6605)
* Source MySQL - added option to connect using ssl * Source MySQL - updated changelog * dummy commit * Updated PR as per comment * added source mysql strict encrypt * updated code style for MySQL source * updated code style for MySQL source * fixed remarks * fixed code style * fixed remarks Co-authored-by: ievgeniit <ievgeniit> Co-authored-by: ievgeniit <etsybaev@gmail.com>
This commit is contained in:
@@ -53,6 +53,10 @@ public class MySqlSource extends AbstractJdbcSource implements Source {
|
||||
"requireSSL=true",
|
||||
"verifyServerCertificate=false");
|
||||
|
||||
public static Source sshWrappedSource() {
|
||||
return new SshWrappedSource(new MySqlSource(), List.of("host"), List.of("port"));
|
||||
}
|
||||
|
||||
public MySqlSource() {
|
||||
super(DRIVER_CLASS, new MySqlJdbcStreamingQueryConfiguration());
|
||||
}
|
||||
@@ -178,7 +182,8 @@ public class MySqlSource extends AbstractJdbcSource implements Source {
|
||||
jdbcUrl.append("&").append(config.get("jdbc_url_params").asText());
|
||||
}
|
||||
|
||||
if (config.has("ssl") && config.get("ssl").asBoolean()) {
|
||||
// assume ssl if not explicitly mentioned.
|
||||
if (!config.has("ssl") || config.get("ssl").asBoolean()) {
|
||||
jdbcUrl.append("&").append(String.join("&", SSL_PARAMETERS));
|
||||
}
|
||||
|
||||
@@ -236,7 +241,7 @@ public class MySqlSource extends AbstractJdbcSource implements Source {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final Source source = new SshWrappedSource(new MySqlSource(), List.of("host"), List.of("port"));
|
||||
final Source source = MySqlSource.sshWrappedSource();
|
||||
LOGGER.info("starting source: {}", MySqlSource.class);
|
||||
new IntegrationRunner(source).run(args);
|
||||
LOGGER.info("completed source: {}", MySqlSource.class);
|
||||
|
||||
@@ -42,6 +42,13 @@
|
||||
"type": "string",
|
||||
"order": 5
|
||||
},
|
||||
"ssl": {
|
||||
"title": "SSL Connection",
|
||||
"description": "Encrypt data using SSL.",
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"order": 7
|
||||
},
|
||||
"replication_method": {
|
||||
"type": "string",
|
||||
"title": "Replication Method",
|
||||
|
||||
@@ -114,8 +114,8 @@ class MySqlTest {
|
||||
})
|
||||
void testSmallIntTypes(String type) throws Exception {
|
||||
database.query(ctx -> {
|
||||
ctx.fetch(String.format("CREATE TABLE %s(id %s)", JdbcUtils.getFullyQualifiedTableName(null, TABLE_NAME), type));
|
||||
ctx.fetch(String.format("INSERT INTO %s(id) VALUES (10)", JdbcUtils.getFullyQualifiedTableName(null, TABLE_NAME)));
|
||||
ctx.fetch(String.format("CREATE TABLE %s(id %s)", TABLE_NAME, type));
|
||||
ctx.fetch(String.format("INSERT INTO %s(id) VALUES (10)", TABLE_NAME));
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user