instance = P6Util.forName(value.toString()).newInstance(); } catch (Exception ex) {
private void loadDriversExplicitly(P6SpyLoadableOptions spyOptions) { final Collection<String> driverNames = spyOptions.getDriverNames(); if (null != driverNames) { for (String driverName : driverNames) { try { // you really only need to load the driver if it is not a // type 4 driver! P6Util.forName(driverName).newInstance(); } catch (Exception e) { String err = "Error registering driver names: " + driverNames + " \nCaused By: " + e.toString(); P6LogQuery.error(err); throw new P6DriverNotFoundError(err); } } } }
@Override public Connection createConnection() throws SQLException { Driver driver; try { driver = (Driver) P6Util.forName(getDriverClassName()).newInstance(); } catch (Exception e) { throw new RuntimeException(e); } return new DriverConnectionFactory(driver, getUrl(), connectionProperties).createConnection(); } };
@Before public void setUpFramework() throws Exception { // clean table plz (we need to make sure that all the configured factories will be re-loaded) new DefaultJdbcEventListenerFactory().clearCache(); Collection<String> driverNames = P6SpyOptions.getActiveInstance().getDriverNames(); String user = P6TestOptions.getActiveInstance().getUser(); String password = P6TestOptions.getActiveInstance().getPassword(); String url = P6TestOptions.getActiveInstance().getUrl(); if (driverNames != null && !driverNames.isEmpty()) { for (String driverName : driverNames) { P6Util.forName(driverName); } } Driver driver = DriverManager.getDriver(url); if (log.isDebugEnabled()) { log.debug("FRAMEWORK USING DRIVER == " + driver.getClass().getName() + " FOR URL " + url); } connection = DriverManager.getConnection(url, user, password).unwrap(ConnectionWrapper.class); P6TestUtil.printAllDrivers(); P6TestUtil.setupTestData(url, user, password); }
final XADataSource realInTestDs = (XADataSource) P6Util.forName( testOptions.getXaDataSource().getClass().getName()).newInstance(); setXADSProperties(realInTestDs, testOptions.getUrl().replace("p6spy:", ""), final XADataSource realFixedDs = (XADataSource) P6Util.forName("org.h2.jdbcx.JdbcDataSource") .newInstance(); setXADSProperties(realFixedDs, "jdbc:h2:mem:p6spy_realFixedDs", "sa", "sa");
instance = P6Util.forName(value.toString()).newInstance(); } catch (Exception ex) {
private void loadDriversExplicitly(P6SpyLoadableOptions spyOptions) { final Collection<String> driverNames = spyOptions.getDriverNames(); if (null != driverNames) { for (String driverName : driverNames) { try { // you really only need to load the driver if it is not a // type 4 driver! P6Util.forName(driverName).newInstance(); } catch (Exception e) { String err = "Error registering driver names: " + driverNames + " \nCaused By: " + e.toString(); P6LogQuery.error(err); throw new P6DriverNotFoundError(err); } } } }
private void loadDriversExplicitly(P6SpyLoadableOptions spyOptions) { final Collection<String> driverNames = spyOptions.getDriverNames(); if (null != driverNames) { for (String driverName : driverNames) { try { // you really only need to load the driver if it is not a // type 4 driver! P6Util.forName(driverName).newInstance(); } catch (Exception e) { String err = "Error registering driver names: " + driverNames + " \nCaused By: " + e.toString(); P6LogQuery.error(err); throw new P6DriverNotFoundError(err); } } } }