public static void loadDriver ( String driverClassName ) throws ClassNotFoundException { // let's try the thread context class loader first // let's try to use the system class loader try { Class . forName ( driverClassName ) ; } catch ( ClassNotFoundException e ) { try { Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( driverClassName ) ; } catch ( ClassNotFoundException e2 ) { // now let's try the classloader which loaded us try { Sql . class . getClassLoader ( ) . loadClass ( driverClassName ) ; } catch ( ClassNotFoundException e3 ) { throw e ; } } } }
Attempts to load the JDBC driver on the thread current or system class loaders