private void obtainDriver()

in dekaf-jdbc/src/impl/JdbcFacade.java [92:121]


    private void obtainDriver()
            throws DBInitializationException
    {
        driver = null;

        if (driverClassName == null)
            throw new DBInitializationException("Driver class name is not specified");

        Class<? extends Driver> driverClass;
        try {
            Class<?> theClass = driverClassLoader.loadClass(driverClassName);
            driverClass = theClass.asSubclass(Driver.class);
        }
        catch (ClassNotFoundException cnfe) {
            throw new DBInitializationException("Cannot load driver: no driver class: " + driverClassName, cnfe);
        }
        catch (ClassCastException cce) {
            throw new DBInitializationException("Cannot load driver: the given class is not a driver: " + driverClassName, cce);
        }

        try {
            driver = driverClass.getDeclaredConstructor().newInstance();
        }
        catch (Exception e) {
            String exceptionName = e.getClass().getSimpleName();
            String exceptionMessage = e.getMessage();
            String message = "Cannot instantiate driver: exception " + exceptionName + ": " + exceptionMessage;
            throw new DBInitializationException(message, e);
        }
    }