Class DriverLoader
- java.lang.Object
-
- org.owasp.dependencycheck.data.nvdcve.DriverLoader
-
@ThreadSafe public final class DriverLoader extends java.lang.Object
DriverLoader is a utility class that is used to load database drivers.- Author:
- Jeremy Long
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
cleanup(java.sql.Driver driver)
De-registers the driver.static java.sql.Driver
load(java.lang.String className)
Loads the specified class using the system class loader and registers the driver with the driver manager.static java.sql.Driver
load(java.lang.String className, java.lang.String pathToDriver)
Loads the specified class by registering the supplied paths to the class loader and then registers the driver with the driver manager.
-
-
-
Method Detail
-
cleanup
public static void cleanup(java.sql.Driver driver)
De-registers the driver.- Parameters:
driver
- the driver to de-register
-
load
public static java.sql.Driver load(java.lang.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 java.sql.Driver load(java.lang.String className, java.lang.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 classpathToDriver
- 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
-
-