code: public static Driver loadDriver(final URL jarUrl) {
          final URLClassLoader driverCl = URLClassLoader.
              newInstance(new URL[] { jarUrl }, null);
  
          final Iterator<Driver> iter = ServiceLoader.
              load(Driver.class, driverCl).iterator();
  
          if (!iter.hasNext()) {
              System.err.println("No JDBC driver found: " + jarUrl);
              return null;
          } // end of if
  
          // ---
  
          Driver d;
          while (iter.hasNext()) {
              d = iter.next();
  
              if (driverCl.equals(d.getClass().getClassLoader())) {
                  return d; // Ignore driver at system classloader
                  // e.g. sun.jdbc.odbc.JdbcOdbcDriver
              } // end of if
          } // end of while
  
          return null;
      }
docs: Returns JDBC driver declared in specified JAR.
  
  @param jarUrl URL to JAR file