use of org.springframework.jdbc.datasource.DriverManagerDataSource in project ORCID-Source by ORCID.
the class DBUnitTest method getDBConnection.
public static IDatabaseConnection getDBConnection() throws Exception {
DriverManagerDataSource dataSource = (DriverManagerDataSource) context.getBean("simpleDataSource");
Connection jdbcConnection = dataSource.getConnection();
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new CustomDataTypeFactory());
return connection;
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project SpringStepByStep by JavaProgrammerLB.
the class DatabaseConfig method dataSource.
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/myminitwit");
dataSource.setUsername("root");
dataSource.setPassword("root");
return dataSource;
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project simple-java by angryziber.
the class HibernatePhotoSpotRepositoryIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
dataSource = new DriverManagerDataSource("jdbc:h2:mem:hibernate;DB_CLOSE_DELAY=-1", "sa", "sa");
System.setProperty("hibernate.dialect", H2Dialect.class.getName());
System.setProperty("hibernate.hbm2ddl.auto", "create-drop");
AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();
sessionFactory.setDataSource(dataSource);
sessionFactory.setAnnotatedClasses(new Class[] { PhotoSpot.class });
sessionFactory.afterPropertiesSet();
repo.hibernate = new HibernateTemplate(sessionFactory.getObject());
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project spring-framework by spring-projects.
the class RdbmsOperationTests method declareParameterAfterCompile.
@Test
public void declareParameterAfterCompile() {
operation.setDataSource(new DriverManagerDataSource());
operation.setSql("select * from mytable");
operation.compile();
exception.expect(InvalidDataAccessApiUsageException.class);
operation.declareParameter(new SqlParameter(Types.INTEGER));
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project nikita-noark5-core by HiOA-ABI.
the class ProdDataSource method dataSource.
// beans
/*
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
//em.setPackagesToScan("no.arkivlab.hioa.nikita.client.persistence.model");
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}*/
@Bean(name = "dataSource")
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(env.getProperty("spring.datasource.driverClassName"));
dataSource.setUrl(env.getProperty("spring.datasource.url"));
dataSource.setUsername(env.getProperty("spring.datasource.username"));
dataSource.setPassword(env.getProperty("spring.datasource.password"));
return dataSource;
}
Aggregations