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

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

Introduction

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

Prototype

void setDriverClass(Class<? extends Driver> driverClass);

Source Link

Document

Set the JDBC driver class to use to connect to the database.

Usage

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//from  www .j  ava2  s .co  m
        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: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: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  w  w  w  .ja  v a2s . com
            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("");
}