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: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:net.sourceforge.subsonic.dao.HsqlDaoHelper.java

private DataSource createDataSource() {
    File subsonicHome = SettingsService.getSubsonicHome();
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName("org.hsqldb.jdbcDriver");
    ds.setUrl("jdbc:hsqldb:file:" + subsonicHome.getPath() + "/db/subsonic");
    ds.setUsername("sa");
    ds.setPassword("");

    return ds;//from  w  ww  . ja  v  a 2 s . c  om
}

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  .  j a v  a2s  .  com
        this.server = Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", String.valueOf(randomPort))
                .start();
    } catch (SQLException e) {
        throw new IllegalStateException(e);
    }
}

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).
 *//*  w  w  w  .j a  v a 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.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//www  . ja v  a 2 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:ru.develgame.jflickrorganizer.MainClass.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource basicDataSource = new DriverManagerDataSource();
    basicDataSource.setDriverClassName("org.sqlite.JDBC");
    basicDataSource.setUrl("jdbc:sqlite:" + properties.getProperty("pathToDB", ""));
    basicDataSource.setUsername("");
    basicDataSource.setPassword("");
    return basicDataSource;
}

From source file:com.MockGatewayApplication.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName(dbDriver);/*  w w  w  .  j  av  a2 s  .com*/
    ds.setUrl(dbUrl);
    ds.setUsername(dbUsername);
    ds.setPassword(dbPassword);

    return ds;
}

From source file:io.convergencia.training.Application.java

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

From source file:com.example.DBConfig.java

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

    dataSource.setDriverClassName(env.getRequiredProperty(PROP_DATABASE_DRIVER));
    dataSource.setUrl(env.getRequiredProperty(PROP_DATABASE_URL));
    dataSource.setUsername(env.getRequiredProperty(PROP_DATABASE_USERNAME));
    dataSource.setPassword(env.getRequiredProperty(PROP_DATABASE_PASSWORD));

    return dataSource;
}