Here you can find the source of loadDriver(String driver)
Parameter | Description |
---|
public static Class loadDriver(String driver) throws SQLException
//package com.java2s; /** Copyright (C) (MSA, Inc) All rights reserved. ** General Public License: http://www.opensource.org/licenses/gpl-license.php **//* w w w .j av a 2s . c om*/ import java.sql.*; public class Main { /** * Holds the default JDBC driver. * Value is "sun.jdbc.odbc.JdbcOdbcDriver". */ public static final String DEFAULT_DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver"; /** load the driver, if 'driver' is null then uses DEFAULT_DRIVER ** @param driver, String ** @return Class, the class loaded with Class.forName **/ public static Class loadDriver(String driver) throws SQLException { try { if (driver == null) driver = DEFAULT_DRIVER; System.out.println("........loading:" + driver); Class drCl = Class.forName(driver); return drCl; } catch (IllegalArgumentException iae) { throw new SQLException("Driver class (" + driver + "): possibly wrong format: " + iae.getMessage()); } catch (ClassNotFoundException e) { throw new SQLException("Could not find database driver class:" + driver); } } }