You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/05/06 01:38:43 UTC

[GitHub] [incubator-seatunnel] ruanwenjun commented on a diff in pull request #1781: [Bug] [flink-connector-jdbc]change jdbc Source connector to get fields from jdbc meta data and support oracle database

ruanwenjun commented on code in PR #1781:
URL: https://github.com/apache/incubator-seatunnel/pull/1781#discussion_r866431270


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-jdbc/src/main/java/org/apache/seatunnel/flink/jdbc/source/JdbcSource.java:
##########
@@ -273,12 +234,13 @@ private RowTypeInfo getRowTypeInfo() {
         return new RowTypeInfo(typeInformation, names);
     }
 
-    private TypeInformationMap getTypeInformationMap(String driverName) {
-        driverName = driverName.toLowerCase();
-        if (driverName.contains("mysql")) {
+    private TypeInformationMap getTypeInformationMap(String databaseDialect) {
+        if ("mysql".equalsIgnoreCase(databaseDialect)) {
             return new MysqlTypeInformationMap();
-        } else if (driverName.contains("postgresql")) {
+        } else if ("postgresql".equalsIgnoreCase(databaseDialect)) {
             return new PostgresTypeInformationMap();
+        } else if ("oracle".equalsIgnoreCase(databaseDialect)) {
+            return new OracleTypeInformationMap();

Review Comment:
   I didn't test on all database, but in my knowledge, the result of `getDatabaseProductName` from oracle driver may not `oracle`, it will contain other character. So it's better to use `StringUtils.containsIgnoreCase(databaseDialect, "xx")`.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org