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.project.framework.configuration.DBConfig.java

@Bean
public DataSource getDataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(env.getProperty("postgresql.driver"));
    dataSource.setUrl(env.getProperty("postgresql.url"));
    dataSource.setUsername(env.getProperty("postgresql.username"));
    dataSource.setPassword(env.getProperty("postgresql.password"));
    return dataSource;
}

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

/**
 * Builds a JNDI datasource./*from www.  j  a  v  a  2  s .co  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:se.omegapoint.facepalm.client.config.DatabaseConfig.java

@Bean
public DataSource dataSource() {
    final 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"));
    final Properties properties = new Properties();
    dataSource.setConnectionProperties(properties);
    return dataSource;
}

From source file:org.dspace.orm.DSpaceDataSourceBuilder.java

public DriverManagerDataSource createInstall(DatabaseInformation information) {
    DriverManagerDataSource driver = new DriverManagerDataSource();
    driver = new DriverManagerDataSource();
    driver.setDriverClassName(information.getDriverClass().getName());
    driver.setUrl(information.getURL());
    driver.setUsername(information.getUser());
    driver.setPassword(information.getPass());
    return driver;
}

From source file:io.spring.JpaApplicationTests.java

@Before
public void setup() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(DATASOURCE_DRIVER_CLASS_NAME);
    dataSource.setUrl(DATASOURCE_URL);
    dataSource.setUsername(DATASOURCE_USER_NAME);
    dataSource.setPassword(DATASOURCE_USER_PASSWORD);
    this.dataSource = dataSource;
    try {//from www .jav a 2s .  co m
        this.server = Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", String.valueOf(randomPort))
                .start();
    } catch (SQLException e) {
        throw new IllegalStateException(e);
    }
}

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:com.MockGatewayApplication.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName(dbDriver);//from w w  w. j a  v a  2s  .  c o m
    ds.setUrl(dbUrl);
    ds.setUsername(dbUsername);
    ds.setPassword(dbPassword);

    return ds;
}

From source file:com.thesoftwareguild.flightmaster.configuration.DaoConfig.java

@Bean
public DriverManagerDataSource datasource() {
    DriverManagerDataSource dmds = new DriverManagerDataSource();
    dmds.setDriverClassName("com.mysql.jdbc.Driver");
    dmds.setUrl("jdbc:mysql://localhost:3306/flights");
    dmds.setUsername("root");
    dmds.setPassword("");
    return dmds;/*from   w w  w  .ja  v  a2  s  . co  m*/
}

From source file:br.com.joaops.springdatajpajavaconfigfirebird.configuration.DataConfiguration.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.firebirdsql.jdbc.FBDriver");
    dataSource.setUrl("jdbc:firebirdsql://localhost:3050/C:/BancoDados/BookStore.fdb");
    dataSource.setUsername("SYSDBA");
    dataSource.setPassword("masterkey");
    return dataSource;
}

From source file:com.pavikumbhar.javaheart.springconfiguration.DataSourceConfig.java

@Bean
@Profile("dev")/*from   w w w. j a  va  2 s .  c  o m*/
public DataSource dataSourceDev() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(environment.getRequiredProperty("database.driverClass"));
    dataSource.setUrl(environment.getRequiredProperty("database.url"));
    dataSource.setUsername(environment.getRequiredProperty("database.username"));
    dataSource.setPassword(environment.getRequiredProperty("database.password"));
    return dataSource;
}