Example usage for org.springframework.jdbc.datasource DriverManagerDataSource setUrl

List of usage examples for org.springframework.jdbc.datasource DriverManagerDataSource setUrl

Introduction

In this page you can find the example usage for org.springframework.jdbc.datasource DriverManagerDataSource setUrl.

Prototype

public void setUrl(@Nullable String url) 

Source Link

Document

Set the JDBC URL to use for connecting through the Driver.

Usage

From source file:cz.swi2.mendeluis.dataaccesslayer.core.DatabaseConfig.java

@Bean
public DataSource db() {
    DriverManagerDataSource builder = new DriverManagerDataSource();
    builder.setDriverClassName("com.mysql.jdbc.Driver");
    builder.setUrl("jdbc:mysql://127.0.0.1:3306/mendeluis?zeroDateTimeBehavior=convertToNull");
    builder.setUsername("mendeluis");
    builder.setPassword("mendeluis");

    return builder;

}

From source file:com.itn.configuration.HibernateConfiguration.java

@Bean
public DataSource ds() {
    DriverManagerDataSource dm = new DriverManagerDataSource();
    dm.setDriverClassName(env.getRequiredProperty("hibernate.driver_class"));
    dm.setUrl(env.getRequiredProperty("hibernate.url"));
    dm.setUsername(env.getRequiredProperty("hibernate.username"));
    dm.setPassword(env.getRequiredProperty("hibernate.password"));
    return dm;//from   w  w  w  . jav  a 2 s .  c o m
}

From source file:br.com.alura.casadocodigo.conf.JPAConfiguration.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();

    JpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    factoryBean.setJpaVendorAdapter(adapter);

    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setUsername("root");
    dataSource.setPassword("");
    dataSource.setUrl("jdbc:mysql://localhost:3306/casadocodigo");
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    factoryBean.setDataSource(dataSource);

    Properties properties = new Properties();
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
    properties.setProperty("hibernate.show_sql", "true");
    properties.setProperty("hibernate.hbm2ddl.auto", "update");
    factoryBean.setJpaProperties(properties);

    factoryBean.setPackagesToScan("br.com.alura.casadocodigo.models");

    return factoryBean;
}

From source file:com.mycompany.spring2explore.config.PersistenceJPAConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.postgresql.Driver");
    dataSource.setUrl("jdbc:postgresql://127.0.0.1:5432/mydb");
    dataSource.setUsername("postgres");
    dataSource.setPassword("pwdpsql");
    return dataSource;
}

From source file:br.com.joaops.awc.configuration.PersistenceConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.postgresql.Driver");
    dataSource.setUrl("jdbc:postgresql://localhost/awc");
    dataSource.setUsername("postgres");
    dataSource.setPassword("postgres");
    return dataSource;
}

From source file:com.alejandroszlv.mock.repository.config.RepositoryConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(dbDriver);
    dataSource.setUrl(dbURL);
    dataSource.setUsername(dbUser);/*from   w w w  .  j  av a  2 s  .com*/
    dataSource.setPassword(dbPAssword);
    return dataSource;
}

From source file:com.mycompany.projetsportmanager.spring.configuration.LocalBdProfileConfiguration.java

/**
 * Builds a JNDI datasource./*  w w w  . j  a  va 2 s.  c  o m*/
 * @return the datasource.
 */
@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    //dataSource.setDriverClassName(oracle.jdbc.OracleDriver.class.getName());
    dataSource.setUrl("jdbc:oracle:thin:@{host}:{port}:{sid}");
    dataSource.setUsername("{user}");
    dataSource.setPassword("{password}");
    return dataSource;
}

From source file:uk.co.parso.barebones.DbConfig.java

@Bean
@Resource(name = "jdbc/test")
public DataSource testDataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setUrl(
            "jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull&useUnicode=true&connectTimeout=5000&socketTimeout=60000");
    dataSource.setUsername("sam");
    dataSource.setPassword("sam");

    return dataSource;
}

From source file:at.christophwurst.orm.config.IntegrationalTestsConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.apache.derby.jdbc.ClientDriver");
    dataSource.setUrl("jdbc:derby://localhost/WorkLogDb;create=true");
    dataSource.setUsername("user");
    dataSource.setPassword("test");
    return dataSource;
}

From source file:pl.edu.uksw.j2eecourse.configuration.LibraryConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.hsqldb.jdbc.JDBCDriver");
    dataSource.setUrl("jdbc:hsqldb:mem:mem");
    dataSource.setUsername("SA");
    dataSource.setPassword("");
    return dataSource;
}