Pierre Villard created NIFI-14682:
-------------------------------------

             Summary: Help user with JDBC Driver configuration in DBCP 
controller service
                 Key: NIFI-14682
                 URL: https://issues.apache.org/jira/browse/NIFI-14682
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Extensions
            Reporter: Pierre Villard
            Assignee: Pierre Villard


The goal is to improve the verify method in the Abstract class as well as the 
error handling in the getDriver method of the controller service implementation.

We cannot use a customValidate approach as we may be in situation where one of 
those situations happen:
 * specified resources are not loaded in the classpath
 * some specified resources are using the URL approach and we may not have the 
resource locally available at the time
 * we may have some weirdly packaged JARs with very custom Drivers

Given the above, we don't want to take the risk of making the component invalid 
and unusable.

Instead we improve things in two places:
 * the verify() method but we cannot expect all of the specified resources to 
be loaded in the classpath at the time the method is called so the best 
approach is to have a static analysis of whatever is available to us and 
provide a non exhaustive list of what drivers can be used.
 * the getDriver() method - in this case, resources are loaded in the classpath 
so we can also verify that the classes that we suspect are potential drivers 
could indeed be loaded as drivers.

The changes have been tested with many drivers, specified in different ways 
(asset, directory, file, URL) with many different vendors (H2, Derby, MS SQL, 
Postgres, ClickHouse, Snowflake).

While this does not cover all possible scenarios of how the component has been 
configured, it does provide a more helpful error message in most cases when the 
specified driver class is not correct.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to