/** * Constructor * * @param config the Config object * @throws IOException */ JDBCAccessBase(Config config) throws IOException { super(); this.config = config; this.dataSource = DataSourceFinder.getDataSource(config.getDataSourceParams()); }
public JDBCAccessCustom(Config config) throws IOException { super(); this.config = config; this.dataSource = DataSourceFinder.getDataSource(config.getDataSourceParams()); }
/** * @return datasource for this dialect object * @throws Exception */ private DataSource getDataSource() throws Exception { if (dataSource != null) { return dataSource; } Config config = getConfig(); dataSource = DataSourceFinder.getDataSource(config.getDataSourceParams()); return dataSource; }
public void testDbcpFactory() throws IOException { assertTrue(new DBCPDataSourceFactory().isAvailable()); DataSourceFinder.scanForPlugins(); Map map = new HashMap(); map.put(DBCPDataSourceFactory.DSTYPE.key, "DBCP"); map.put(DBCPDataSourceFactory.DRIVERCLASS.key, "org.h2.Driver"); map.put(DBCPDataSourceFactory.JDBC_URL.key, "jdbc:h2:mem:test_mem"); map.put(DBCPDataSourceFactory.USERNAME.key, "admin"); map.put(DBCPDataSourceFactory.PASSWORD.key, ""); map.put(DBCPDataSourceFactory.MAXACTIVE.key, Integer.valueOf(10)); map.put(DBCPDataSourceFactory.MAXIDLE.key, Integer.valueOf(0)); DataSource source = DataSourceFinder.getDataSource(map); assertNotNull(source); assertTrue(source instanceof BasicDataSource); }