Java Code Examples for org.apache.kylin.common.KylinConfig#getJdbcSourceDialect()

The following examples show how to use org.apache.kylin.common.KylinConfig#getJdbcSourceDialect() . 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 File: SourceConnectorFactory.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
public static JdbcConnector getJdbcConnector(KylinConfig config) {
    String jdbcUrl = config.getJdbcSourceConnectionUrl();
    String jdbcDriver = config.getJdbcSourceDriver();
    String jdbcUser = config.getJdbcSourceUser();
    String jdbcPass = config.getJdbcSourcePass();
    String adaptorClazz = config.getJdbcSourceAdaptor();

    AdaptorConfig jdbcConf = new AdaptorConfig(jdbcUrl, jdbcDriver, jdbcUser, jdbcPass);
    jdbcConf.poolMaxIdle = config.getPoolMaxIdle(null);
    jdbcConf.poolMinIdle = config.getPoolMinIdle(null);
    jdbcConf.poolMaxTotal = config.getPoolMaxTotal(null);
    jdbcConf.datasourceId = config.getJdbcSourceDialect();

    if (adaptorClazz == null)
        adaptorClazz = decideAdaptorClassName(jdbcConf.datasourceId);

    try {
        return new JdbcConnector(AdaptorFactory.createJdbcAdaptor(adaptorClazz, jdbcConf));
    } catch (Exception e) {
        throw new RuntimeException("Failed to get JdbcConnector from env.", e);
    }
}
 
Example 2
Source File: SourceConnectorFactory.java    From kylin with Apache License 2.0 6 votes vote down vote up
public static JdbcConnector getJdbcConnector(KylinConfig config) {
    String jdbcUrl = config.getJdbcSourceConnectionUrl() == null ? config.getJdbcUrl(null) : config.getJdbcSourceConnectionUrl();
    String jdbcDriver = config.getJdbcSourceDriver() == null ? config.getJdbcDriverClass(null) : config.getJdbcSourceDriver();
    String jdbcUser = config.getJdbcSourceUser() == null ? config.getJdbcUsername(null) : config.getJdbcSourceUser();
    String jdbcPass = config.getJdbcSourcePass() == null ? config.getJdbcPassword(null) : config.getJdbcSourcePass();
    String adaptorClazz = config.getJdbcSourceAdaptor();

    AdaptorConfig jdbcConf = new AdaptorConfig(jdbcUrl, jdbcDriver, jdbcUser, jdbcPass);
    jdbcConf.poolMaxIdle = config.getPoolMaxIdle(null);
    jdbcConf.poolMinIdle = config.getPoolMinIdle(null);
    jdbcConf.poolMaxTotal = config.getPoolMaxTotal(null);
    jdbcConf.datasourceId = config.getJdbcSourceDialect();

    if (adaptorClazz == null)
        adaptorClazz = decideAdaptorClassName(jdbcConf.datasourceId);

    try {
        return new JdbcConnector(AdaptorFactory.createJdbcAdaptor(adaptorClazz, jdbcConf));
    } catch (Exception e) {
        throw new RuntimeException("Failed to get JdbcConnector from env.", e);
    }
}