List of usage examples for org.apache.commons.dbcp BasicDataSource setUrl
public synchronized void setUrl(String url)
Sets the #url .
Note: this method currently has no effect once the pool has been initialized.
From source file:com.dangdang.ddframe.rdb.sharding.config.yaml.YamlShardingDataSourceTest.java
private DataSource createDataSource() { BasicDataSource result = new BasicDataSource(); result.setDriverClassName(Driver.class.getName()); result.setUrl("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL"); result.setUsername("sa"); result.setPassword(""); return result; }
From source file:com.bt.aloha.testing.JdbcHelper.java
private DataSource buildDataSource(String driver, String url, String username, String password) throws Exception { log.debug(String.format("Building datasource %s, %s, %s, %s", driver, url, username, password)); BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(driver);/*from w w w. j av a 2 s. c o m*/ ds.setUrl(url); ds.setUsername(username); ds.setPassword(password); return ds; }
From source file:cz.muni.fi.pv168.dressroomAppGui.MainMenuFrame.java
public static DataSource prepareDataSource() throws SQLException { BasicDataSource dataSource = new BasicDataSource(); //dataSource.setUrl("jdbc:derby:memory:dressroom-gui;create=true"); dataSource.setUrl( java.util.ResourceBundle.getBundle("cz.muni.fi.pv168.dressroomappgui/settings").getString("url")); dataSource.setUsername(//w w w . j a v a 2 s. co m java.util.ResourceBundle.getBundle("cz.muni.fi.pv168.dressroomappgui/settings").getString("user")); dataSource.setPassword(java.util.ResourceBundle.getBundle("cz.muni.fi.pv168.dressroomappgui/settings") .getString("password")); return dataSource; }
From source file:Metodos.Pool.java
private void inicializaDataSource() { BasicDataSource basicDataSource = new BasicDataSource(); //basicDataSource.setDriverClassName("org.gjt.mm.mysql.Driver"); basicDataSource.setUsername(user);/*from w w w . j ava 2 s . c o m*/ basicDataSource.setPassword(pass); basicDataSource.setUrl(url); basicDataSource.setMaxActive(50); dataSource = basicDataSource; }
From source file:com.dangdang.ddframe.rdb.integrate.AbstractDBUnitTest.java
private DataSource createDataSource(final String dataSetFile) { if (DATA_SOURCES.containsKey(dataSetFile)) { return DATA_SOURCES.get(dataSetFile); }//from w w w. j a v a2s. c om BasicDataSource result = new BasicDataSource(); result.setDriverClassName(dbEnv.getDriverClassName()); result.setUrl(dbEnv.getURL(getFileName(dataSetFile))); result.setUsername(dbEnv.getUsername()); result.setPassword(dbEnv.getPassword()); result.setMaxActive(1000); DATA_SOURCES.put(dataSetFile, result); return result; }
From source file:fr.gouv.diplomatie.applitutoriel.integration.conf.DataSourceConf.java
@Bean public DataSource dataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(driverClassName); dataSource.setUrl(url); dataSource.setUsername(username);//from w ww.ja va 2 s . c o m dataSource.setPassword(password); dataSource.setValidationQuery(validationQuery); dataSource.setMaxActive(maxActive); dataSource.setMaxIdle(maxIdle); dataSource.setMaxWait(maxWait); dataSource.setTestOnBorrow(testOnBorrow); dataSource.setTestWhileIdle(testWhileIdle); dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); dataSource.setNumTestsPerEvictionRun(numTestsPerEvictionRun); dataSource.setRemoveAbandoned(removeAbandoned); dataSource.setRemoveAbandonedTimeout(removeAbandonedTimeout); dataSource.setLogAbandoned(logAbandoned); return dataSource; }
From source file:com.consol.citrus.samples.todolist.dao.JdbcTodoListDao.java
private DataSource createDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("org.hsqldb.jdbcDriver"); dataSource.setUrl("jdbc:hsqldb:hsql://localhost/testdb"); dataSource.setUsername("sa"); dataSource.setPassword(""); return dataSource; }
From source file:com.tedexis.commons.db.DBSinglePool.java
/** * Crea el pool de conexiones/*from ww w.j a v a 2 s .com*/ * * @param configurationDB * @return * @throws ClassNotFoundException */ private BasicDataSource getBasicDataSource(ConfigurationDB configurationDB) throws ClassNotFoundException { BasicDataSource ds = null; if (dataSource == null) { ds = new BasicDataSource(); Class.forName(configurationDB.driverClass); ds.setUrl(configurationDB.url); ds.setDriverClassName(configurationDB.driverClass); ds.setUsername(configurationDB.user); ds.setPassword(configurationDB.password); ds.setInitialSize(configurationDB.poolSize); ds.setMaxActive(configurationDB.poolMaxAct); ds.setMaxIdle(configurationDB.poolMaxIdle); ds.setMaxWait(configurationDB.poolWait); return ds; } return dataSource; }
From source file:io.springagora.store.ApplicationConfig.java
/** * Bean definition./*w ww. ja v a 2 s . c om*/ * * Datasource used to retrieve connections for the persistence layer. It's * configured following definitions written in {@code application.properties}. * * @return * The {@code Datasource} object, that will act as the connection pool, * providing connections to the application. * * @throws SQLException * If any error occurs during the connection attempt, it will be thrown * as a {@code SQLException}. */ @Bean public DataSource dataSource() throws SQLException { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("com.mysql.jdbc.Driver"); ds.setUrl(connectionUrl); ds.setUsername(username); ds.setPassword(password); ds.setInitialSize(5); ds.setMaxActive(20); ds.setDefaultAutoCommit(false); return ds; }
From source file:com.dangdang.ddframe.job.lite.console.restful.EventTraceHistoryRestfulApi.java
private DataSource setUpEventTraceDataSource() { BasicDataSource result = new BasicDataSource(); result.setDriverClassName(eventTraceDataSourceConfiguration.getDriver()); result.setUrl(eventTraceDataSourceConfiguration.getUrl()); result.setUsername(eventTraceDataSourceConfiguration.getUsername()); result.setPassword(eventTraceDataSourceConfiguration.getPassword()); return result; }