42799

I referred to the documentation here: https://clickhouse.com/docs/en/integrations/java/jdbc-driver. The documentation mentions the latest version as 0.6.5, but on their GitHub releases page (https://github.com/ClickHouse/clickhouse-java/releases), the latest version is 0.7.0.

I did not use version 0.7.0 because it has a compile dependency on clickhouse-http-client:0.7.0-SNAPSHOT (https://mvnrepository.com/artifact/com.clickhouse/clickhouse-jdbc/0.7.0).

Additionally, I verified the driver locally with the following test:

@Testcontainers(disabledWithoutDocker = true)
class ClickhouseIntegrationTests {

    @Container
    static final ClickHouseContainer clickhouse = new ClickHouseContainer("clickhouse/clickhouse-server:24-alpine")
        .withUsername("test")
        .withPassword("password");

    @Test
    void shouldConnectToClickhouse ()  {
        String jdbcUrl = clickhouse.getJdbcUrl();
        SimpleDriverDataSource dataSource = DataSourceBuilder.create()
            .type(SimpleDriverDataSource.class)
            .url(jdbcUrl)
            .username("test")
            .password("password")
            .build();
        new JdbcTemplate(dataSource).execute(DatabaseDriver.CLICKHOUSE.getValidationQuery());
    }

}

By the way, when I updated the version to 0.7.0, Gradle was against this:

Execution failed for task ':spring-boot-project:spring-boot:compileKotlin'.
> Could not resolve all files for configuration ':spring-boot-project:spring-boot:compileClasspath'.
   > Could not find com.clickhouse:clickhouse-http-client:0.7.0-SNAPSHOT.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/clickhouse/clickhouse-http-client/0.7.0-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/com/clickhouse/clickhouse-http-client/0.7.0-SNAPSHOT/clickhouse-http-client-0.7.0-SNAPSHOT.pom
       - https://repo.spring.io/milestone/com/clickhouse/clickhouse-http-client/0.7.0-SNAPSHOT/maven-metadata.xml
       - https://repo.spring.io/milestone/com/clickhouse/clickhouse-http-client/0.7.0-SNAPSHOT/clickhouse-http-client-0.7.0-SNAPSHOT.pom
       - https://repo.spring.io/snapshot/com/clickhouse/clickhouse-http-client/0.7.0-SNAPSHOT/maven-metadata.xml
       - https://repo.spring.io/snapshot/com/clickhouse/clickhouse-http-client/0.7.0-SNAPSHOT/clickhouse-http-client-0.7.0-SNAPSHOT.pom
     Required by:
         project :spring-boot-project:spring-boot > com.clickhouse:clickhouse-jdbc:0.7.0

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Comment From: nosan

0.7.0 could be used but this requires adding an additional module:

modules = [
    "clickhouse-jdbc",
    **"clickhouse-http-client"**
]

Comment From: philwebb

Thanks @nosan! Given that we don't really have any direct integration with ClickHouse, I've removed it as a managed dependency. I think this is a good middle ground that means we can support the URLs without needing to worry about which version to depend on.

Comment From: nosan

Thank you, @philwebb