Java Code Examples for org.jooq.tools.jdbc.JDBCUtils

The following examples show how to use org.jooq.tools.jdbc.JDBCUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: micronaut-sql   Source File: JooqConfigurationProperties.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Resolve {@link SQLDialect} to be used for the data source.
 * If SQL dialect is not set explicitly, automatic detection will be done.
 *
 * @param dataSource data source for automatic detection
 * @return Effective SQL dialect
 */
public SQLDialect determineSqlDialect(DataSource dataSource) {
    if (this.sqlDialect != null) {
        return this.sqlDialect;
    }
    if (dataSource == null) {
        return SQLDialect.DEFAULT;
    }
    try (Connection connection = dataSource.getConnection()) {
        return JDBCUtils.dialect(connection);
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}
 
Example 2
Source Project: droptools   Source File: JooqFactory.java    License: Apache License 2.0 5 votes vote down vote up
private SQLDialect determineDialect(PooledDataSourceFactory dataSourceFactory, ManagedDataSource dataSource) {
    // If a dialect was specified, great!
    if (getDialect().isPresent()) {
        return dialect.get();
    }

    return JDBCUtils.dialect(dataSourceFactory.getUrl());
}
 
Example 3
protected DSLContext createDSLContext()
{
  return DSL.using(store.getConnection(), JDBCUtils.dialect(store.getDatabaseUrl()));
}