List of usage examples for org.springframework.jdbc.datasource.embedded EmbeddedDatabaseType HSQL
EmbeddedDatabaseType HSQL
To view the source code for org.springframework.jdbc.datasource.embedded EmbeddedDatabaseType HSQL.
Click Source Link
From source file:org.ow2.proactive.scheduling.api.Application.java
private DataSource createMemDataSource() { EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.HSQL).build(); return db;/* w ww. ja va 2 s . c o m*/ }
From source file:br.com.valecard.config.MainConfig.java
@Bean public DataSource dataSource() { //Abaixo est configurado para obter propriedades do sistema que podem //ser passadas via opo -Dprop=value do java //entretando pode ser configurado de diversas maneiras // DriverManagerDataSource dataSource = new DriverManagerDataSource(); // dataSource.setDriverClassName(environment.getProperty("database.driverClassName")); // String url = environment.getProperty("MYSQL_URL_AGENDOO"); // if (url.startsWith("mysql://")) {//ajuste para cloudbees funcionar // url = "jdbc:" + url; // }/*from ww w .j a va2s . c o m*/ // dataSource.setUrl(url); // dataSource.setUsername(environment.getProperty("MYSQL_USERNAME_AGENDOO")); // dataSource.setPassword(environment.getProperty("MYSQL_PASSWORD_AGENDOO")); // LOG.info("Inicializando datasource: " + dataSource.getUrl()); // return dataSource; EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); return builder.setType(EmbeddedDatabaseType.HSQL).build(); }
From source file:org.tdmx.lib.zone.service.MockZonePartitionIdInstaller.java
private void installZoneDB(String partitionId) { EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); builder = builder.setType(EmbeddedDatabaseType.HSQL).addScript("zoneDBPartition-schema.sql"); builder.setName(partitionId);//from ww w.ja v a 2 s . c om builder.continueOnError(false); builder.ignoreFailedDrops(true); builder.build(); }
From source file:me.bulat.jivr.webmin.config.DataAppConfig.java
@Profile("test") @Bean(name = "hsqlDataSource") public DataSource getEmbeddedDataSource() { return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).addScript("classpath:schema.sql") .addScript("classpath:test-data.sql").build(); }
From source file:com.acmemotors.batch.LoaderJobConfiguration.java
/** * Configures the embedded data source used by this Spring Batch job. * * @return the {@link javax.sql.DataSource} to be used by Spring Batch for the job * repository//from w w w .java 2 s .com */ @Bean public DataSource dataSource() { EmbeddedDatabaseBuilder embeddedDatabaseBuilder = new EmbeddedDatabaseBuilder(); return embeddedDatabaseBuilder.addScript("classpath:org/springframework/batch/core/schema-drop-hsqldb.sql") .addScript("classpath:org/springframework/batch/core/schema-hsqldb.sql") .setType(EmbeddedDatabaseType.HSQL).build(); }
From source file:org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.java
/** * Hook to initialize the embedded database. * <p>If the {@code generateUniqueDatabaseName} flag has been set to {@code true}, * the current value of the {@linkplain #setDatabaseName database name} will * be overridden with an auto-generated name. * <p>Subclasses may call this method to force initialization; however, * this method should only be invoked once. * <p>After calling this method, {@link #getDataSource()} returns the * {@link DataSource} providing connectivity to the database. *///from w ww . j a v a 2 s. c om protected void initDatabase() { if (this.generateUniqueDatabaseName) { setDatabaseName(UUID.randomUUID().toString()); } // Create the embedded database first if (this.databaseConfigurer == null) { this.databaseConfigurer = EmbeddedDatabaseConfigurerFactory.getConfigurer(EmbeddedDatabaseType.HSQL); } this.databaseConfigurer.configureConnectionProperties(this.dataSourceFactory.getConnectionProperties(), this.databaseName); this.dataSource = this.dataSourceFactory.getDataSource(); if (logger.isInfoEnabled()) { if (this.dataSource instanceof SimpleDriverDataSource) { SimpleDriverDataSource simpleDriverDataSource = (SimpleDriverDataSource) this.dataSource; logger.info(String.format("Starting embedded database: url='%s', username='%s'", simpleDriverDataSource.getUrl(), simpleDriverDataSource.getUsername())); } else { logger.info(String.format("Starting embedded database '%s'", this.databaseName)); } } // Now populate the database if (this.databasePopulator != null) { try { DatabasePopulatorUtils.execute(this.databasePopulator, this.dataSource); } catch (RuntimeException ex) { // failed to populate, so leave it as not initialized shutdownDatabase(); throw ex; } } }