Search in sources :

Example 1 with ClickHouseDriver

use of ru.yandex.clickhouse.ClickHouseDriver in project hetu-core by openlookeng.

the class ClickHouseClientModule method createConnectionFactory.

@Provides
@Singleton
public static ConnectionFactory createConnectionFactory(BaseJdbcConfig config, ClickHouseConfig clickHouseConfig) {
    Properties connectionProperties = basicConnectionProperties(config);
    connectionProperties.setProperty(ClickHouseConnectionSettings.SOCKET_TIMEOUT.getKey(), String.valueOf(clickHouseConfig.getSocketTimeout()));
    return new DriverConnectionFactory(new ClickHouseDriver(), config.getConnectionUrl(), Optional.ofNullable(config.getUserCredentialName()), Optional.ofNullable(config.getPasswordCredentialName()), connectionProperties);
}
Also used : ClickHouseDriver(ru.yandex.clickhouse.ClickHouseDriver) DriverConnectionFactory(io.prestosql.plugin.jdbc.DriverConnectionFactory) Properties(java.util.Properties) DriverConnectionFactory.basicConnectionProperties(io.prestosql.plugin.jdbc.DriverConnectionFactory.basicConnectionProperties) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 DriverConnectionFactory (io.prestosql.plugin.jdbc.DriverConnectionFactory)1 DriverConnectionFactory.basicConnectionProperties (io.prestosql.plugin.jdbc.DriverConnectionFactory.basicConnectionProperties)1 Properties (java.util.Properties)1 ClickHouseDriver (ru.yandex.clickhouse.ClickHouseDriver)1