Skip to content

Commit

Permalink
[improve][connector] JDBC sink: allow any jdbc driver (apache#17951)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi authored Oct 11, 2022
1 parent 252eded commit 5c31c9a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ public void open(Map<String, Object> config, SinkContext sinkContext) throws Exc
properties.setProperty("password", password);
}


Class.forName(JdbcUtils.getDriverClassName(jdbcSinkConfig.getJdbcUrl()));
connection = DriverManager.getConnection(jdbcSinkConfig.getJdbcUrl(), properties);
connection.setAutoCommit(!jdbcSinkConfig.isUseTransactions());
log.info("Opened jdbc connection: {}, autoCommit: {}", jdbcUrl, connection.getAutoCommit());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,4 @@ public static String buildDeleteSql(TableDefinition table) {
public static PreparedStatement buildDeleteStatement(Connection connection, String deleteSQL) throws SQLException {
return connection.prepareStatement(deleteSQL);
}

public static String getDriverClassName(String jdbcUrl) throws Exception {
for (JdbcDriverType type : JdbcDriverType.values()) {
if (type.matches(jdbcUrl)) {
return type.getDriverClass();
}
}
throw new Exception("Provided JDBC connection string contains unknown driver: " + jdbcUrl);
}

}

0 comments on commit 5c31c9a

Please sign in to comment.