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

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

Introduction

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

Prototype

public DriverManagerDataSource() 

Source Link

Document

Constructor for bean-style configuration.

Usage

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/*from ww  w.j  av  a2 s.c o  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.mycompany.swing2explore.config.PersistenceJPAConfig.java

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

From source file:de.voolk.marbles.spring.context.MarblesAppContext.java

@Bean
public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(config().get("database.driver"));
    // jdbc:hsqldb:mem:aname
    dataSource.setUrl(config().getProperties().getProperty("database.url"));
    dataSource.setUsername(config().get("database.user"));
    dataSource.setPassword(config().get("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);/*from  w ww . j ava  2 s . com*/
    dataSource.setUsername(username);
    dataSource.setPassword(password);

    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: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 w w  w .j  av  a2 s.c o  m*/
        this.server = Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", String.valueOf(randomPort))
                .start();
    } catch (SQLException e) {
        throw new IllegalStateException(e);
    }
}

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.dynamobi.ws.util.UserToDataSource.java

public UserToDataSource() throws ClassNotFoundException, IOException {
    super();/*ww w . j  av a  2 s  .  c  o  m*/

    Properties pro = new Properties();

    InputStream user_props = this.getClass().getResourceAsStream("/luciddb-jdbc.properties");
    if (user_props != null) {
        pro.load(user_props);
    } else {
        pro.load(this.getClass().getResourceAsStream("/luciddb-jdbc-default.properties"));
    }

    String jdbc_driver = pro.getProperty("jdbc.driver");
    Class.forName(jdbc_driver);

    String username = pro.getProperty("jdbc.username");
    String password = pro.getProperty("jdbc.password");
    String jdbc_url = pro.getProperty("jdbc.url");

    // this sets up the connection to validate other connections.
    DriverManagerDataSource data_source = new DriverManagerDataSource();
    data_source.setDriverClassName(jdbc_driver);
    data_source.setUrl(jdbc_url);
    data_source.setUsername(username);
    data_source.setPassword(password);
    setTargetDataSource(data_source);
}

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;
}