Search in sources :

Example 26 with DriverManagerDataSource

use of org.springframework.jdbc.datasource.DriverManagerDataSource in project shiro by apache.

the class ApplicationConfig method dataSource.

/**
 * Sample RDBMS data source that would exist in any application - not Shiro related.
 * @return
 */
@Bean
protected DriverManagerDataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
    dataSource.setUrl("jdbc:hsqldb:mem:shiro-spring");
    dataSource.setUsername("sa");
    return dataSource;
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) Bean(org.springframework.context.annotation.Bean)

Example 27 with DriverManagerDataSource

use of org.springframework.jdbc.datasource.DriverManagerDataSource in project survey by markoniemi.

the class JpaConfig method dataSource.

@Bean
public DataSource dataSource() {
    // datasource is filled from database.properties, which is filled from survey/pom.xml
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(databaseDriver);
    dataSource.setUrl(databaseUrl);
    dataSource.setUsername(databaseUsername);
    dataSource.setPassword(databasePassword);
    return dataSource;
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 28 with DriverManagerDataSource

use of org.springframework.jdbc.datasource.DriverManagerDataSource in project runelite by runelite.

the class CacheConfiguration method dataSource.

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setUrl(jdbcUrl);
    dataSource.setUsername(jdbcUsername);
    dataSource.setPassword(jdbcPassword);
    return dataSource;
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) Bean(org.springframework.context.annotation.Bean)

Example 29 with DriverManagerDataSource

use of org.springframework.jdbc.datasource.DriverManagerDataSource in project Gemma by PavlidisLab.

the class GoldenPath method init.

void init() {
    assert databaseName != null;
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    this.url = "jdbc:mysql://" + host + ":" + port + "/" + databaseName + "?relaxAutoCommit=true";
    GoldenPath.log.info("Connecting to " + databaseName);
    GoldenPath.log.debug("Connecting to Golden Path : " + url + " as " + user);
    dataSource.setDriverClassName(this.getDriver());
    dataSource.setUrl(url);
    dataSource.setUsername(user);
    dataSource.setPassword(password);
    jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.setFetchSize(50);
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate)

Example 30 with DriverManagerDataSource

use of org.springframework.jdbc.datasource.DriverManagerDataSource in project simple-java by angryziber.

the class JDBCPhotoSpotRepositoryIntegrationTest method initMockDB.

@Before
public void initMockDB() throws Exception {
    repo.dataSource = new DriverManagerDataSource("jdbc:h2:mem:test", "sa", "sa");
    conn = repo.dataSource.getConnection();
    conn.createStatement().execute("create table PhotoSpot (id int auto_increment primary key, name varchar, description varchar, latitude float, longitude float)");
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) Before(org.junit.Before)

Aggregations

DriverManagerDataSource (org.springframework.jdbc.datasource.DriverManagerDataSource)66 Bean (org.springframework.context.annotation.Bean)29 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)20 Test (org.junit.jupiter.api.Test)9 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)8 DataSource (javax.sql.DataSource)7 SQLException (java.sql.SQLException)4 Properties (java.util.Properties)4 PersistenceUnitInfo (jakarta.persistence.spi.PersistenceUnitInfo)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 Connection (java.sql.Connection)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 InitialContext (javax.naming.InitialContext)2 XADataSource (javax.sql.XADataSource)2 Before (org.junit.Before)2 ApplicationContextHolder (org.mifos.application.servicefacade.ApplicationContextHolder)2 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)2