2. Code Example

InitializingBasicDataSource, InitializingDriverManagerDataSource, and HsqldbInitializingDriverManagerDataSource are all standard DataSources and be used anywhere one is needed. It can be passed into a JdbcTemplate, a Hibernate session factory, etc.

                
@Autowired
private DataSource ds = null;

public void process() {
    JdbcTemplate template = new JdbcTemplate(ds);

    ...
}