Polber commented on code in PR #30024:
URL: https://github.com/apache/beam/pull/30024#discussion_r1458126592
##########
sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcReadSchemaTransformProvider.java:
##########
@@ -68,8 +73,29 @@ public
JdbcReadSchemaTransform(JdbcReadSchemaTransformConfiguration config) {
}
protected JdbcIO.DataSourceConfiguration dataSourceConfiguration() {
+ String driverClassName = config.getDriverClassName();
+
+ if (Strings.isNullOrEmpty(driverClassName)) {
+ switch (Objects.requireNonNull(config.getJdbcType()).toLowerCase()) {
+ case "mysql":
+ driverClassName = "com.mysql.cj.jdbc.Driver";
+ break;
+ case "postgres":
+ driverClassName = "org.postgresql.Driver";
+ break;
+ case "oracle":
+ driverClassName = "oracle.jdbc.driver.OracleDriver";
+ break;
+ case "mssql":
+ driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
+ break;
Review Comment:
Good idea! I'll add that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]