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

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

Introduction

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

Prototype

public void setPassword(@Nullable String password) 

Source Link

Document

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

Usage

From source file:org.jhk.pulsing.web.service.ProdServiceConfig.java

public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(env.getRequiredProperty("datasource.driver_class"));
    dataSource.setUrl(env.getRequiredProperty("datasource.url"));
    dataSource.setUsername(env.getRequiredProperty("datasource.user"));
    dataSource.setPassword(env.getRequiredProperty("datasource.password"));
    return dataSource;
}

From source file:ca.weblite.contacts.webservice.RESTServiceConfiguration.java

@Bean
public DataSource getDataSource() {
    if (DB_USERNAME == null || DB_PASSWORD == null || DB_URL == null) {
        loadRuntimeSettings();//w w  w .j  a v a 2 s.  c  om
    }
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setUrl(DB_URL);
    dataSource.setUsername(DB_USERNAME);
    dataSource.setPassword(DB_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(/*from   ww  w .j a v a  2  s . com*/
            "jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull&useUnicode=true&connectTimeout=5000&socketTimeout=60000");
    dataSource.setUsername("sam");
    dataSource.setPassword("sam");

    return dataSource;
}

From source file:org.mitre.jdbc.datasource.H2DataSourceFactory.java

protected DataSource createDataSource() {
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName("org.h2.Driver");
    ds.setUrl(getConnectionString());//from w w  w . ja  v a2  s . co m
    ds.setUsername("sa");
    ds.setPassword("");
    logger.debug("Created dataSource: " + ds.toString());
    return ds;
}

From source file:de.alexandria.cms.config.SpringConfigBackendDatabase.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName("org.postgresql.Driver");
    ds.setUrl("jdbc:postgresql://" + databaseHostname + ":" + databasePort + "/" + databaseName);
    ds.setUsername(databaseUsername);//ww  w.  j  a  va  2 s . com
    ds.setPassword(databasePassword);
    ds.setConnectionProperties(getConnectionProperties());
    return ds;
}

From source file:de.hska.ld.core.config.PersistenceConfig.java

@Bean
public DataSource dataSource() throws SQLException {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(env.getProperty("module.core.db.driver"));
    dataSource.setUrl(env.getProperty("module.core.db.url"));
    dataSource.setUsername(env.getProperty("module.core.db.username"));
    dataSource.setPassword(env.getProperty("module.core.db.password"));
    return dataSource;
}

From source file:com.fantasy.AggregatorConfig.java

@Bean
public DataSource dataSource() {

    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.postgresql.Driver");
    dataSource.setUrl("jdbc:postgresql://localhost:5432/fantasy");
    dataSource.setUsername("postgres");
    dataSource.setPassword("notorious");
    return dataSource;
}

From source file:com.github.fedorchuck.webstore.dao.impl.postgresql.JdbcCommodityRepositoryTest.java

@Before
@Ignore/* ww w  .j  a  va  2  s. c o m*/
public void setUp() {
    try {
        //TODO: should be rewritten.

        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(Config.DRIVERCLASSNAME);
        dataSource.setUrl(Config.URL);
        dataSource.setUsername(Config.USERNAME);
        dataSource.setPassword(Config.PASSWORD);
        jdbc = new JdbcCommodityRepository(new JdbcTemplate(dataSource));
        //TODO: run creating scripts.
        Assert.assertTrue(true);
    } catch (Throwable throwable) {
        Assert.fail(throwable.getMessage());
    }
}

From source file:py.una.pol.karaku.configuration.KarakuPersistence.java

/**
 * Crea un datasource con los valores definidos en el karaku.properties.
 * /*  w  w  w .  jav a  2 s.com*/
 * @return dataSource creada o null si no se necesita un datasource
 */
@Bean
public DataSource dataSource() {

    DriverManagerDataSource dataSource = null;
    if (this.enabled) {
        dataSource = new DriverManagerDataSource();
        dataSource.setUrl(this.properties.get("database.url"));
        dataSource.setUsername(this.properties.get("database.user"));
        dataSource.setPassword(this.properties.get("database.password"));
    }

    return dataSource;
}