Search in sources :

Example 6 with DataSourceConnectionProvider

use of org.jooq.impl.DataSourceConnectionProvider in project curiostack by curioswitch.

the class DatabaseModule method dbContext.

@Provides
@Singleton
static DSLContext dbContext(DataSource dataSource, @ForDatabase ListeningExecutorService dbExecutor) {
    Configuration configuration = new DefaultConfiguration().set(dbExecutor).set(SQLDialect.MYSQL).set(new Settings().withRenderSchema(false)).set(new DataSourceConnectionProvider(dataSource)).set(DatabaseUtil.sfmRecordMapperProvider());
    DSLContext ctx = DSL.using(configuration);
    // Eagerly trigger JOOQ classinit for better startup performance.
    ctx.select().from("curio_server_framework_init").getSQL();
    return ctx;
}
Also used : DefaultConfiguration(org.jooq.impl.DefaultConfiguration) Configuration(org.jooq.Configuration) DataSourceConnectionProvider(org.jooq.impl.DataSourceConnectionProvider) DSLContext(org.jooq.DSLContext) DefaultConfiguration(org.jooq.impl.DefaultConfiguration) Settings(org.jooq.conf.Settings) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 7 with DataSourceConnectionProvider

use of org.jooq.impl.DataSourceConnectionProvider in project collect by openforis.

the class ApplicationInitializerServletContextListener method initDB.

private void initDB() {
    LOG.info("========Open Foris Collect - Starting DB initialization ========");
    DataSourceConnectionProvider connectionProvider = new DataSourceConnectionProvider(DbUtils.getDataSource());
    new DbInitializer(connectionProvider).start();
    LOG.info("========Open Foris Collect - DB Initialized ====================");
}
Also used : DbInitializer(org.openforis.collect.persistence.DbInitializer) DataSourceConnectionProvider(org.jooq.impl.DataSourceConnectionProvider)

Aggregations

DataSourceConnectionProvider (org.jooq.impl.DataSourceConnectionProvider)7 DSLContext (org.jooq.DSLContext)5 DefaultConfiguration (org.jooq.impl.DefaultConfiguration)5 Configuration (org.jooq.Configuration)3 Settings (org.jooq.conf.Settings)3 Provides (dagger.Provides)2 Singleton (javax.inject.Singleton)2 ConnectionProvider (org.jooq.ConnectionProvider)2 HikariConfig (com.zaxxer.hikari.HikariConfig)1 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1 SQLException (java.sql.SQLException)1 Properties (java.util.Properties)1 DataSource (javax.sql.DataSource)1 ContextExpression (liquibase.ContextExpression)1 LabelExpression (liquibase.LabelExpression)1 Liquibase (liquibase.Liquibase)1 ChangeLogParameters (liquibase.changelog.ChangeLogParameters)1 DatabaseChangeLog (liquibase.changelog.DatabaseChangeLog)1 JdbcConnection (liquibase.database.jvm.JdbcConnection)1 DatabaseException (liquibase.exception.DatabaseException)1