Here you can find the source of createDriver(ClassLoader classLoader, String driverClassName)
public static Driver createDriver(ClassLoader classLoader, String driverClassName) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.Driver; import java.sql.SQLException; public class Main { public static Driver createDriver(String driverClassName) throws SQLException { return createDriver(null, driverClassName); }//from ww w .ja va2 s . co m public static Driver createDriver(ClassLoader classLoader, String driverClassName) throws SQLException { Class<?> clazz = null; if (classLoader != null) { try { clazz = classLoader.loadClass(driverClassName); } catch (ClassNotFoundException e) { // swallow it } } if (clazz == null) { try { ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); if (contextLoader != null) { clazz = contextLoader.loadClass(driverClassName); } } catch (ClassNotFoundException e) { // swallow it } } if (clazz == null) { try { clazz = Class.forName(driverClassName); } catch (ClassNotFoundException e) { throw new SQLException(e.getMessage(), e); } } try { return (Driver) clazz.newInstance(); } catch (IllegalAccessException e) { throw new SQLException(e.getMessage(), e); } catch (InstantiationException e) { throw new SQLException(e.getMessage(), e); } } }