yuqi1129 opened a new issue, #13854:
URL: https://github.com/apache/gravitino/issues/13854

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   When a JDBC catalog's driver ships only in the catalog's `libs` directory, 
creating the catalog fails with `No suitable driver`. ClickHouse is one 
example. The driver JAR is present and `jdbc-driver` names it.
   
   The create-time probe added in #13767 resolves the driver with 
`DriverManager.getDriver` (`JdbcCatalogOperations.probeConnection` → 
`getDriver()`). `DriverManager` only discovers drivers on the server classpath 
by itself. A driver in the catalog's isolated class loader registers only when 
its class is initialized, and nothing has initialized it yet when the probe 
runs:
   - The DBCP pool loads the driver lazily, on its first connection.
   - `DataSourceUtils.verifyDriverPresent` loads the class with 
`initialize=false`.
   
   Providers whose driver was registered earlier by some other path are not 
affected.
   
   ### Error message and/or stacktrace
   
   ```
   Failed to connect to JDBC catalog at <host>:<port>: No suitable driver
   ```
   
   ### How to reproduce
   
   1. Put the ClickHouse JDBC driver in `catalogs/jdbc-clickhouse/libs`.
   2. Create a `jdbc-clickhouse` catalog with `jdbc-driver` set to 
`com.clickhouse.jdbc.ClickHouseDriver`, without setting 
`verify-on-create=false`.
   3. The create fails with `No suitable driver`.
   
   ### Additional context
   
   The probe was also cherry-picked to branch-1.3 (#13780), so branch-1.3 is 
affected as well.
   


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