public OracleValidConnectionChecker() { try { clazz = JdbcUtils.loadDriverClass("oracle.jdbc.driver.OracleConnection"); if (clazz != null) { ping = clazz.getMethod("pingDatabase", new Class[] {Integer.TYPE}); } else { ping = null; } } catch (Exception e) { throw new RuntimeException("Unable to resolve pingDatabase method:", e); } }
public Driver createDriver(String className) throws SQLException { Class<?> rawDriverClass = JdbcUtils.loadDriverClass(className); if (rawDriverClass == null) { throw new SQLException("jdbc-driver's class not found. '" + className + "'"); } Driver rawDriver; try { rawDriver = (Driver) rawDriverClass.newInstance(); } catch (InstantiationException e) { throw new SQLException("create driver instance error, driver className '" + className + "'"); } catch (IllegalAccessException e) { throw new SQLException("create driver instance error, driver className '" + className + "'"); } return rawDriver; }