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

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

Introduction

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

Prototype

public void setUsername(@Nullable String username) 

Source Link

Document

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

Usage

From source file:com.example.spring.boot.config.DatabaseConfig.java

/**
 * DataSource definition for database connection. Settings are read from the
 * application.properties file (using the env object).
 *///www.ja  va 2s .  c o  m
@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(env.getProperty("db.driver"));
    dataSource.setUrl(env.getProperty("db.url"));
    dataSource.setUsername(env.getProperty("db.username"));
    dataSource.setPassword(env.getProperty("db.password"));
    return dataSource;
}

From source file:com.springmvc.videoteca.spring.config.SpringDBConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
    dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
    dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
    dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
    return dataSource;
}

From source file:com.opencart.config.SpringConfigurations.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource datasource = new DriverManagerDataSource();

    datasource.setDriverClassName("oracle.jdbc.OracleDriver");
    datasource.setUrl("jdbc:oracle:thin:@dilbert.humber.ca:1521:grok");
    datasource.setUsername("n01072473");
    datasource.setPassword("oracle");
    return datasource;
}

From source file:com.pojur.config.JPAConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(environment.getProperty("jdbc.driverClassName"));
    dataSource.setUrl(environment.getProperty("jdbc.url"));
    dataSource.setUsername(environment.getProperty("jdbc.username"));
    dataSource.setPassword(environment.getProperty("jdbc.password"));
    //        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    //        dataSource.setUrl("jdbc:mysql://localhost:3306/spring2explore");
    //        dataSource.setUsername("root");
    //        dataSource.setPassword("pwdroot");
    return dataSource;
}

From source file:runtheshow.frontend.config.AppConfiguration.java

@Bean
public DriverManagerDataSource dataSource() {
    DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
    driverManagerDataSource.setDriverClassName("com.mysql.jdbc.Driver");
    driverManagerDataSource.setUrl("jdbc:mysql://localhost:3306/runtheshow");
    driverManagerDataSource.setUsername("root");
    driverManagerDataSource.setPassword("Run$The$Show");
    return driverManagerDataSource;
}

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.aerolinea.config.WebConfig.java

@Bean
public DriverManagerDataSource restDataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setUrl("jdbc:mysql://localhost:3306/aerolinea?zeroDateTimeBehavior=convertToNull");
    dataSource.setUsername("root");
    dataSource.setPassword("tic506");

    return dataSource;
}

From source file:com.app.config.App2Config.java

/**
 * Primary because if we have activated embedded databases, we do not want
 * the application to connect to an external database.
 *
 * @return/* w  w w. j a  v  a2 s  .co  m*/
 */
@Bean(name = "appDataSource")
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();

    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setUrl("jdbc:mysql://localhost/iivos_ap");
    dataSource.setUsername("root");
    dataSource.setPassword("");

    return dataSource;
}

From source file:com.banco.config.RootConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();

    dataSource.setDriverClassName(env.getRequiredProperty(PROPERTY_NAME_DATABASE_DRIVER));
    dataSource.setUrl(env.getRequiredProperty(PROPERTY_NAME_DATABASE_URL));
    dataSource.setUsername(env.getRequiredProperty(PROPERTY_NAME_DATABASE_USERNAME));
    dataSource.setPassword(env.getRequiredProperty(PROPERTY_NAME_DATABASE_PASSWORD));

    return dataSource;
}

From source file:com.github.fedorchuck.webstore.config.DataConfig.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(driverClassName);
    dataSource.setUrl(url);//w  w  w .j av  a 2 s .  c o m
    dataSource.setUsername(username);
    dataSource.setPassword(password);

    return dataSource;
}