Example usage for org.springframework.jdbc.datasource.embedded ConnectionProperties setUrl

List of usage examples for org.springframework.jdbc.datasource.embedded ConnectionProperties setUrl

Introduction

In this page you can find the example usage for org.springframework.jdbc.datasource.embedded ConnectionProperties setUrl.

Prototype

void setUrl(String url);

Source Link

Document

Set the JDBC connection URL for the database.

Usage

From source file:sf.wicklet.gwt.site.server.db.H2Configurator.java

@Override
public void configureConnectionProperties(final ConnectionProperties properties, final String dbname) {
    properties.setDriverClass(driverClass);
    properties.setUrl(String.format("jdbc:h2:%s;AUTOCOMMIT=ON", dbPath));
    properties.setUsername("sa");
    properties.setPassword("");
}

From source file:com.porvak.bracket.config.EmbeddedDataConfig.java

@Bean
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("bracketcloud");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    EmbeddedDatabaseConfigurer config = new EmbeddedDatabaseConfigurer() {
        @Override/*  ww  w. ja  v a 2  s  .  com*/
        public void configureConnectionProperties(ConnectionProperties connectionProperties, String s) {
            connectionProperties.setDriverClass(org.h2.Driver.class);
            connectionProperties.setUrl("jdbc:h2:tcp://localhost/~/bracketcloud");
            connectionProperties.setUsername("sa");
        }

        @Override
        public void shutdown(DataSource dataSource, String s) {

        }
    };

    //factory.setDatabaseConfigurer(config);
    return populateDatabase(factory.getDatabase());
}

From source file:org.fao.geonet.GeonetworkH2TestEmbeddedDatabaseConfigurer.java

public void configureConnectionProperties(ConnectionProperties properties, String databaseName) {
    properties.setDriverClass(this.driverClass);
    //        properties.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=FALSE", databaseName));
    if (_dbPathLocator.isPresent()) {
        try {/*from   www  .j a  v a 2 s  .co m*/
            properties.setUrl(
                    String.format("jdbc:h2:%s;DB_CLOSE_DELAY=-1%s", _dbPathLocator.get().call(), _mode));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    } else {
        properties.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1%s", databaseName, _mode));
    }
    properties.setUsername(_username);
    properties.setPassword(_password);
}

From source file:org.springframework.jdbc.datasource.embedded.DerbyEmbeddedDatabaseConfigurer.java

@Override
public void configureConnectionProperties(ConnectionProperties properties, String databaseName) {
    properties.setDriverClass(EmbeddedDriver.class);
    properties.setUrl(String.format(URL_TEMPLATE, databaseName, "create=true"));
    properties.setUsername("sa");
    properties.setPassword("");
}