Class DriverLoader

java.lang.Object
org.owasp.dependencycheck.data.nvdcve.DriverLoader

@ThreadSafe public final class DriverLoader extends Object
DriverLoader is a utility class that is used to load database drivers.
Author:
Jeremy Long
  • Method Details

    • cleanup

      public static void cleanup(Driver driver)
      De-registers the driver.
      Parameters:
      driver - the driver to de-register
    • load

      public static Driver load(String className) throws DriverLoadException
      Loads the specified class using the system class loader and registers the driver with the driver manager.
      Parameters:
      className - the fully qualified name of the desired class
      Returns:
      the loaded Driver
      Throws:
      DriverLoadException - thrown if the driver cannot be loaded
    • load

      public static Driver load(String className, String pathToDriver) throws DriverLoadException
      Loads the specified class by registering the supplied paths to the class loader and then registers the driver with the driver manager. The pathToDriver argument is added to the class loader so that an external driver can be loaded. Note, the pathToDriver can contain a semi-colon separated list of paths so any dependencies can be added as needed. If a path in the pathToDriver argument is a directory all files in the directory are added to the class path.
      Parameters:
      className - the fully qualified name of the desired class
      pathToDriver - the path to the JAR file containing the driver; note, this can be a semi-colon separated list of paths
      Returns:
      the loaded Driver
      Throws:
      DriverLoadException - thrown if the driver cannot be loaded