List of usage examples for org.apache.commons.dbcp BasicDataSource BasicDataSource
BasicDataSource
From source file:io.apicurio.hub.core.editing.EditingSessionManagerTest.java
/** * Creates an in-memory datasource.//from w w w . j a v a2 s . c o m * @throws SQLException */ private static BasicDataSource createInMemoryDatasource() { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(Driver.class.getName()); ds.setUsername("sa"); ds.setPassword(""); ds.setUrl("jdbc:h2:mem:test" + (counter++) + ";DB_CLOSE_DELAY=-1"); return ds; }
From source file:com.openteach.diamond.repository.client.impl.database.DataSourceFactory.java
/** * /*from www . ja va2 s . c o m*/ * @return */ public DataSource newInstance() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDefaultAutoCommit(true); dataSource.setDriverClassName(certificate.getDriverClassName()); dataSource.setMaxActive(certificate.getMaxActive()); dataSource.setMaxIdle(certificate.getMaxIdle()); dataSource.setMaxWait(certificate.getMaxWait()); dataSource.setMinIdle(certificate.getMinIdle()); dataSource.setUsername(certificate.getUsername()); dataSource.setPassword(certificate.getPassword()); dataSource.setUrl(certificate.getUrl()); 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.packtpub.spring.ws.javaconfig.config.HibernateConfig.java
@Bean public DataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); dataSource.setUrl(env.getProperty("jdbc.url")); dataSource.setUsername(env.getProperty("jdbc.username")); dataSource.setPassword(env.getProperty("jdbc.password")); return dataSource; }
From source file:com.amuponda.estorehack.business.config.EstoreHackDataConfig.java
@Bean(destroyMethod = "close") public DataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/estore"); dataSource.setUsername("root"); dataSource.setPassword("uctatm"); //This should solve the notorious broken pipe exception dataSource.setValidationQuery("SELECT 1"); dataSource.setTestOnBorrow(true);/*from w ww .java 2s . c o m*/ dataSource.setRemoveAbandoned(true); dataSource.setRemoveAbandonedTimeout(60); dataSource.setLogAbandoned(true); return dataSource; }
From source file:com.dangdang.ddframe.rdb.transaction.soft.integrate.storage.RdbTransactionLogStorageOperationsTest.java
@Test public void assertRdbTransactionLogStorageOperations() throws SQLException { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(org.h2.Driver.class.getName()); dataSource.setUrl("jdbc:h2:mem:db_transaction_storage"); dataSource.setUsername("sa"); dataSource.setPassword(""); createTable(dataSource);//from w ww . j av a2s .com TransactionLogStorage storage = new RdbTransactionLogStorage(dataSource); assertTransactionLogStorageOperations(storage); }
From source file:config.DomainAndPersistenceConfig.java
@Bean public DataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/cabinet"); dataSource.setUsername("root"); dataSource.setPassword(""); return dataSource; }
From source file:com.apress.prospringintegration.batch.JdbcConfiguration.java
@Bean(destroyMethod = "close") public BasicDataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(driverClassName); dataSource.setUrl(url);//from ww w .j a v a 2 s. c o m dataSource.setUsername(username); dataSource.setPassword(password); return dataSource; }
From source file:com.googlecode.jdbcproc.daofactory.guice.SimpleModule.java
@Provides @Singleton// ww w . j ava 2 s. c o m DataSource provideDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/jdbcprocdb"); dataSource.setUsername("jdbcproc"); dataSource.setPassword("jdbcproc"); dataSource.setDefaultAutoCommit(true); dataSource.setValidationQuery("call create_collections()"); return dataSource; }
From source file:net.daw.conexion.implementation.DbcpConnectionPoolImpl.java
@Override public Connection newConnection() { Connection c = null;//from w w w. ja v a2s . c o m basicDataSource = new BasicDataSource(); basicDataSource.setDriverClassName("com.mysql.jdbc.Driver"); basicDataSource.setUsername("root"); basicDataSource.setPassword("bitnami"); basicDataSource.setUrl("jdbc:mysql://127.0.0.1:3306/ausiaxContent"); basicDataSource.setValidationQuery("select 1"); basicDataSource.setMaxActive(100); basicDataSource.setMaxWait(10000); basicDataSource.setMaxIdle(10); return c; }