RocMarshal commented on a change in pull request #16962:
URL: https://github.com/apache/flink/pull/16962#discussion_r780676184



##########
File path: 
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/AbstractJdbcCatalog.java
##########
@@ -188,8 +205,72 @@ public void alterDatabase(String name, CatalogDatabase 
newDatabase, boolean igno
         throw new UnsupportedOperationException();
     }
 
+    @Override
+    public CatalogDatabase getDatabase(String databaseName)
+            throws DatabaseNotExistException, CatalogException {
+
+        Preconditions.checkState(
+                org.apache.commons.lang3.StringUtils.isNotBlank(databaseName),
+                "Database name must not be blank.");
+        if (listDatabases().contains(databaseName)) {
+            return new CatalogDatabaseImpl(Collections.emptyMap(), null);
+        } else {
+            throw new DatabaseNotExistException(getName(), databaseName);
+        }
+    }
+
     // ------ tables and views ------
 
+    @Override
+    public CatalogBaseTable getTable(ObjectPath tablePath)
+            throws TableNotExistException, CatalogException {
+
+        if (!tableExists(tablePath)) {
+            throw new TableNotExistException(getName(), tablePath);
+        }
+
+        String dbUrl = baseUrl + tablePath.getDatabaseName();
+
+        try (Connection conn = DriverManager.getConnection(dbUrl, username, 
pwd)) {

Review comment:
       It's indeed an existing drawback.
   
   However, if we use the automatic connection parameter of JDBC, the 
underlying ping command may cause a large number of logs in the database, such 
as the slow logs of MySQL. If we use a connection pool implementation, 
additional dependencies are introduced.
   Please let me know what do you think of it.




-- 
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]


Reply via email to