Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

BasicDataSource vs DriverManagerDataSource: connection pooling

$
0
0
If I use the following Bean declaration with a jdbcTemplate,
can I automatically assume that connection pooling is being used?

Please notice the usage of
apache.commons.dbcp.BasicDataSource vs springframework.jdbc.datasource.DriverManagerDataS ource

...
import org.apache.commons.dbcp.BasicDataSource;
// (INSTEAD OF org.springframework.jdbc.datasource.DriverManagerD ataSource;
...
@Bean
public BasicDataSource dataSource() {
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName(environment.getProperty("db. driverclass"));
ds.setUrl(environment.getProperty("db.url"));
ds.setUsername(environment.getProperty("db.usernam e"));
ds.setPassword(environment.getProperty("db.passwor d"));
return ds;
}

Thanks

Viewing all articles
Browse latest Browse all 297

Trending Articles