use of org.springframework.jdbc.datasource.SimpleDriverDataSource in project Activiti by Activiti.
the class ActivitiEngineConfiguration method dataSource.
@Bean
public DataSource dataSource() {
SimpleDriverDataSource ds = new SimpleDriverDataSource();
try {
@SuppressWarnings("unchecked") Class<? extends Driver> driverClass = (Class<? extends Driver>) Class.forName(environment.getProperty("jdbc.driver", "org.h2.Driver"));
ds.setDriverClass(driverClass);
} catch (Exception e) {
log.error("Error loading driver class", e);
}
// Connection settings
ds.setUrl(environment.getProperty("jdbc.url", "jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000"));
ds.setUsername(environment.getProperty("jdbc.username", "sa"));
ds.setPassword(environment.getProperty("jdbc.password", ""));
return ds;
}
use of org.springframework.jdbc.datasource.SimpleDriverDataSource in project camunda-bpm-platform by camunda.
the class InMemProcessEngineConfiguration method dataSource.
@Bean
public DataSource dataSource() {
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
dataSource.setDriverClass(org.h2.Driver.class);
dataSource.setUrl("jdbc:h2:mem:camunda-test;DB_CLOSE_DELAY=-1");
dataSource.setUsername("sa");
dataSource.setPassword("");
return dataSource;
}
use of org.springframework.jdbc.datasource.SimpleDriverDataSource in project cas by apereo.
the class JpaBeans method newDataSource.
/**
* New simple data source.
*
* @param driverClass the driver class
* @param username the username
* @param password the password
* @param url the url
* @return the data source
*/
@SneakyThrows
public static DataSource newDataSource(final String driverClass, final String username, final String password, final String url) {
val ds = new SimpleDriverDataSource();
ds.setDriverClass((Class<Driver>) Class.forName(driverClass));
ds.setUsername(username);
ds.setPassword(password);
ds.setUrl(url);
return ds;
}
use of org.springframework.jdbc.datasource.SimpleDriverDataSource in project spring-boot by spring-projects.
the class FlywayAutoConfigurationTests method overrideDataSourceAndDriverClassName.
@Test
void overrideDataSourceAndDriverClassName() {
String jdbcUrl = "jdbc:hsqldb:mem:flyway" + UUID.randomUUID();
String driverClassName = "org.hsqldb.jdbcDriver";
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class).withPropertyValues("spring.flyway.url:" + jdbcUrl, "spring.flyway.driver-class-name:" + driverClassName).run((context) -> {
Flyway flyway = context.getBean(Flyway.class);
SimpleDriverDataSource dataSource = (SimpleDriverDataSource) flyway.getConfiguration().getDataSource();
assertThat(dataSource.getUrl()).isEqualTo(jdbcUrl);
assertThat(dataSource.getDriver().getClass().getName()).isEqualTo(driverClassName);
});
}
use of org.springframework.jdbc.datasource.SimpleDriverDataSource in project spring-boot by spring-projects.
the class DataSourceBuilderTests method buildWhenSimpleDriverTypeSpecifiedReturnsExpectedDataSource.
@Test
void buildWhenSimpleDriverTypeSpecifiedReturnsExpectedDataSource() {
this.dataSource = DataSourceBuilder.create().url("jdbc:h2:test").type(SimpleDriverDataSource.class).build();
assertThat(this.dataSource).isInstanceOf(SimpleDriverDataSource.class);
SimpleDriverDataSource simpleDriverDataSource = (SimpleDriverDataSource) this.dataSource;
assertThat(simpleDriverDataSource.getUrl()).isEqualTo("jdbc:h2:test");
assertThat(simpleDriverDataSource.getDriver()).isInstanceOf(Driver.class);
}
Aggregations