MCPcopy Index your code
hub / github.com/apache/groovy / loadDriver

Method loadDriver

subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java:761–781  ·  view source on GitHub ↗

Attempts to load the JDBC driver on the thread, current or system class loaders @param driverClassName the fully qualified class name of the driver class @throws ClassNotFoundException if the class cannot be found or loaded

(String driverClassName)

Source from the content-addressed store, hash-verified

759 * @throws ClassNotFoundException if the class cannot be found or loaded
760 */
761 public static void loadDriver(String driverClassName) throws ClassNotFoundException {
762 // let's try the thread context class loader first
763 // let's try to use the system class loader
764 try {
765 Class.forName(driverClassName);
766 }
767 catch (ClassNotFoundException e) {
768 try {
769 Thread.currentThread().getContextClassLoader().loadClass(driverClassName);
770 }
771 catch (ClassNotFoundException e2) {
772 // now let's try the classloader which loaded us
773 try {
774 Sql.class.getClassLoader().loadClass(driverClassName);
775 }
776 catch (ClassNotFoundException e3) {
777 throw e;
778 }
779 }
780 }
781 }
782
783 /** Stored procedure OUT parameter marker for JDBC type {@link Types#ARRAY ARRAY}. */
784 public static final OutParameter ARRAY = () -> Types.ARRAY;

Callers 1

newInstanceMethod · 0.95

Calls 3

forNameMethod · 0.80
loadClassMethod · 0.45
getClassLoaderMethod · 0.45

Tested by

no test coverage detected