List of usage examples for org.apache.commons.dbcp BasicDataSource setDriverClassName
public synchronized void setDriverClassName(String driverClassName)
Sets the jdbc driver class name.
Note: this method currently has no effect once the pool has been initialized.
From source file:com.bt.aloha.sipstone.MaintenanceDao.java
public MaintenanceDao() throws Exception { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("sip.properties"); Properties dbProps = new Properties(); dbProps.load(is);// w ww . j ava2 s . c om BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(dbProps.getProperty("database.driverClassName", "org.postgresql.Driver")); ds.setUrl(dbProps.getProperty("database.url", "jdbc:postgresql://localhost:5432/springring")); ds.setUsername(dbProps.getProperty("database.username", "springringuser")); ds.setPassword(dbProps.getProperty("database.password", "springringuser")); this.jdbcTemplate = new JdbcTemplate(ds); }
From source file:net.slipp.config.MainConfig.java
@Bean(destroyMethod = "close") public DataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(environment.getProperty("jdbc.driverClassName")); dataSource.setUrl(environment.getProperty("jdbc.url")); dataSource.setUsername(environment.getProperty("jdbc.username")); dataSource.setPassword(environment.getProperty("jdbc.password")); return dataSource; }
From source file:app.Mysqlconector.java
public DataSource Connection() { if (DataSource == null) { BasicDataSource basicDataSource = new BasicDataSource(); basicDataSource.setDriverClassName(mysql); basicDataSource.setUrl(Url);/*from ww w . jav a 2 s . c o m*/ basicDataSource.setUsername(User); basicDataSource.setPassword(Pass); basicDataSource.setMaxActive(50); DataSource = basicDataSource; } return DataSource; // return conexion; }
From source file:com.abixen.platform.core.configuration.PlatformDataSourceConfiguration.java
@Profile(PlatformProfiles.TEST) @Bean(destroyMethod = "close") public DataSource testDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(platformJdbcConfiguration.getDriverClassName()); dataSource.setUrl(platformJdbcConfiguration.getDatabaseUrl()); dataSource.setUsername(platformJdbcConfiguration.getUsername()); dataSource.setPassword(platformJdbcConfiguration.getPassword()); // DatabasePopulatorUtils.execute(databasePopulator(), dataSource); return dataSource; }
From source file:com.googlecode.jdbcproc.daofactory.guice.SimpleModule.java
@Provides @Singleton//from www .j a va2 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:com.lawulu.bdc.etl.batch.config.DatabaseConfiguration.java
@Bean(destroyMethod = "close") public DataSource dbcpDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/test"); dataSource.setUsername("root"); dataSource.setPassword("root"); dataSource.setMaxActive(20);// w w w .j a v a 2s. c om dataSource.setMaxIdle(20); dataSource.setMaxWait(10000); dataSource.setInitialSize(5); dataSource.setValidationQuery("SELECT 1"); dataSource.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); return dataSource; }
From source file:com.abixen.platform.core.configuration.PlatformDataSourceConfiguration.java
@Profile(PlatformProfiles.DEV) @Bean(destroyMethod = "close") public DataSource devDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(platformJdbcConfiguration.getDriverClassName()); dataSource.setUrl(platformJdbcConfiguration.getDatabaseUrl()); dataSource.setUsername(platformJdbcConfiguration.getUsername()); dataSource.setPassword(platformJdbcConfiguration.getPassword()); //DatabasePopulatorUtils.execute(databasePopulator(), dataSource); return dataSource; //DataSource dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).setName("devDataBase").build(); //return dataSource; }
From source file:com.surveypanel.form.config.LoadConfigTest.java
public void testRbs() { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("org.h2.Driver"); ds.setUsername("sa"); ds.setPassword(""); ds.setUrl("jdbc:h2:mem:surveypanel"); JDBCFormDAO jdbcFormDAO = new JDBCFormDAO(); jdbcFormDAO.setDataSource(ds);/*from ww w .j a va2 s.c om*/ RDBSFormFactory formFactory = new RDBSFormFactory("/form/", jdbcFormDAO); formFactory.init(0); Form form = formFactory.create(0, false); System.out.println(form.getId()); JSManager jsManager = new JSManager(formFactory); Result execute = (Result) jsManager.execute(form, "flow.next();save();"); System.out.println(form.getId()); formFactory.load(form.getId(), 0, false); System.out.println(execute.getLogs()); System.out.println(execute.getError()); assertFalse(execute.hasError()); }
From source file:com.infodev.fcgorole.configuration.AppConfig.java
@Bean(name = "dataSource") public BasicDataSource dataSource() { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("com.mysql.jdbc.Driver"); ds.setUrl("jdbc:mysql://localhost:3306/fcgorecondb"); ds.setUsername("root"); return ds;//from w ww . j a v a 2s . com }
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; }