use of org.springframework.jdbc.core.JdbcTemplate in project spring-framework by spring-projects.
the class EmbeddedDatabaseBuilderTests method createSameSchemaTwiceWithGeneratedUniqueDbNames.
@Test
public void createSameSchemaTwiceWithGeneratedUniqueDbNames() throws Exception {
EmbeddedDatabase db1 = //
new EmbeddedDatabaseBuilder(new ClassRelativeResourceLoader(getClass())).addScripts("db-schema-without-dropping.sql", //
"db-test-data.sql").generateUniqueName(//
true).build();
JdbcTemplate template1 = new JdbcTemplate(db1);
assertNumRowsInTestTable(template1, 1);
template1.update("insert into T_TEST (NAME) values ('Sam')");
assertNumRowsInTestTable(template1, 2);
EmbeddedDatabase db2 = //
new EmbeddedDatabaseBuilder(new ClassRelativeResourceLoader(getClass())).addScripts("db-schema-without-dropping.sql", //
"db-test-data.sql").generateUniqueName(//
true).build();
assertDatabaseCreated(db2);
db1.shutdown();
db2.shutdown();
}
use of org.springframework.jdbc.core.JdbcTemplate in project uPortal by Jasig.
the class SqlPortalDataFunction method setDataSource.
@Required
public void setDataSource(DataSource dataSource) {
final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.afterPropertiesSet();
this.jdbcOperations = jdbcTemplate;
}
use of org.springframework.jdbc.core.JdbcTemplate in project uPortal by Jasig.
the class ProfilesDataFunction method setDataSource.
@Required
public void setDataSource(DataSource dataSource) {
final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.afterPropertiesSet();
this.jdbcOperations = jdbcTemplate;
}
use of org.springframework.jdbc.core.JdbcTemplate in project uPortal by Jasig.
the class PermissionSetsDataFunction method setDataSource.
@Required
public void setDataSource(DataSource dataSource) {
final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.afterPropertiesSet();
this.jdbcOperations = jdbcTemplate;
}
use of org.springframework.jdbc.core.JdbcTemplate in project opennms by OpenNMS.
the class JdbcEventdServiceManager method dataSourceSync.
/* (non-Javadoc)
* @see org.opennms.netmgt.eventd.EventdServiceManager#dataSourceSync()
*/
/**
* <p>dataSourceSync</p>
*/
@Override
public synchronized void dataSourceSync() {
m_serviceMap.clear();
new JdbcTemplate(m_dataSource).query(SQL_DB_SVC_TABLE_READ, new RowCallbackHandler() {
@Override
public void processRow(ResultSet resultSet) throws SQLException {
m_serviceMap.put(resultSet.getString(2), resultSet.getInt(1));
}
});
}
Aggregations