flyrain commented on code in PR #1843:
URL: https://github.com/apache/polaris/pull/1843#discussion_r2141331116


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/DatasourceOperations.java:
##########
@@ -60,59 +60,61 @@ public class DatasourceOperations {
   private final Random random = new Random();
 
   public DatasourceOperations(
-      DataSource datasource,
-      DatabaseType databaseType,
-      RelationalJdbcConfiguration relationalJdbcConfiguration) {
+      DataSource datasource, RelationalJdbcConfiguration 
relationalJdbcConfiguration)
+      throws SQLException {
     this.datasource = datasource;
-    this.databaseType = databaseType;
     this.relationalJdbcConfiguration = relationalJdbcConfiguration;
+    try (Connection connection = this.datasource.getConnection()) {
+      String productName = connection.getMetaData().getDatabaseProductName();
+      this.databaseType = DatabaseType.fromDisplayName(productName);
+    }
   }
 
-  public DatabaseType getDatabaseType() {
+  DatabaseType getDatabaseType() throws SQLException {

Review Comment:
   ```suggestion
     DatabaseType getDatabaseType() {
   ```



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