Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/modules/databases/r2dbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ So that the URL becomes:

#### Using ClickHouse

`r2dbc:tc:clickhouse:///databasename?TC_IMAGE_TAG=21.9.2-alpine`
`r2dbc:tc:clickhouse:///databasename?TC_IMAGE_TAG=21.11.11-alpine`
Comment thread
eddumelendez marked this conversation as resolved.

#### Using MySQL

Expand Down
8 changes: 5 additions & 3 deletions modules/clickhouse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ dependencies {
api project(':jdbc')

compileOnly project(':r2dbc')
compileOnly(group: 'com.clickhouse', name: 'clickhouse-r2dbc', version: '0.7.0', classifier: 'http')
compileOnly(group: 'com.clickhouse', name: 'clickhouse-r2dbc', version: '0.7.2', classifier: 'http')

testImplementation project(':jdbc-test')
testRuntimeOnly(group: 'com.clickhouse', name: 'clickhouse-jdbc', version: '0.7.0', classifier: 'http')
testRuntimeOnly(group: 'com.clickhouse', name: 'clickhouse-jdbc', version: '0.7.2', classifier: 'http')
testRuntimeOnly(group: 'com.clickhouse', name: 'jdbc-v2', version: '0.7.2', classifier: 'http')

testImplementation 'org.apache.httpcomponents.client5:httpclient5:5.4.2'
testImplementation 'org.assertj:assertj-core:3.26.3'
testImplementation testFixtures(project(':r2dbc'))
testRuntimeOnly(group: 'com.clickhouse', name: 'clickhouse-r2dbc', version: '0.7.0', classifier: 'http')
testRuntimeOnly(group: 'com.clickhouse', name: 'clickhouse-r2dbc', version: '0.7.2', classifier: 'http')
Comment thread
eddumelendez marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public class ClickHouseContainer extends JdbcDatabaseContainer<ClickHouseContain

static final Integer NATIVE_PORT = 9000;

private static final String DRIVER_CLASS_NAME = "com.clickhouse.jdbc.ClickHouseDriver";
private static final String LEGACY_V1_RIVER_CLASS_NAME = "com.clickhouse.jdbc.ClickHouseDriver";
Comment thread
eddumelendez marked this conversation as resolved.
Outdated

private static final String DRIVER_CLASS_NAME = "com.clickhouse.jdbc.Driver";

private static final String JDBC_URL_PREFIX = "jdbc:clickhouse://";

Expand Down Expand Up @@ -78,7 +80,12 @@ public Set<Integer> getLivenessCheckPortNumbers() {

@Override
public String getDriverClassName() {
return DRIVER_CLASS_NAME;
try {
Class.forName(DRIVER_CLASS_NAME);
return DRIVER_CLASS_NAME;
} catch (ClassNotFoundException e) {
return LEGACY_V1_RIVER_CLASS_NAME;
Comment thread
eddumelendez marked this conversation as resolved.
Outdated
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.testcontainers.utility.DockerImageName;

public interface ClickhouseTestImages {
DockerImageName CLICKHOUSE_IMAGE = DockerImageName.parse("clickhouse/clickhouse-server:21.9.2-alpine");
DockerImageName CLICKHOUSE_IMAGE = DockerImageName.parse("clickhouse/clickhouse-server:21.11.11-alpine");

DockerImageName CLICKHOUSE_24_12_IMAGE = DockerImageName.parse("clickhouse/clickhouse-server:24.12-alpine");
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ClickHouseContainerTest extends AbstractContainerDatabaseTest {

@Test
public void testSimple() throws SQLException {
try (ClickHouseContainer clickhouse = new ClickHouseContainer("clickhouse/clickhouse-server:21.9.2-alpine")) {
try (ClickHouseContainer clickhouse = new ClickHouseContainer("clickhouse/clickhouse-server:21.11-alpine")) {
clickhouse.start();

ResultSet resultSet = performQuery(clickhouse, "SELECT 1");
Expand All @@ -26,11 +26,12 @@ public void testSimple() throws SQLException {
@Test
public void customCredentialsWithUrlParams() throws SQLException {
try (
ClickHouseContainer clickhouse = new ClickHouseContainer("clickhouse/clickhouse-server:21.9.2-alpine")
ClickHouseContainer clickhouse = new ClickHouseContainer("clickhouse/clickhouse-server:21.11.2-alpine")
.withUsername("default")
.withPassword("")
.withDatabaseName("test")
.withUrlParam("max_result_rows", "5")
// The new driver uses the prefix `clickhouse_setting_` for session settings
.withUrlParam("clickhouse_setting_max_result_rows", "5")
) {
clickhouse.start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ protected ConnectionFactoryOptions getOptions(ClickHouseContainer container) {

@Override
protected String createR2DBCUrl() {
return "r2dbc:tc:clickhouse:///db?TC_IMAGE_TAG=21.9.2-alpine";
return "r2dbc:tc:clickhouse:///db?TC_IMAGE_TAG=21.11.11-alpine";
}

@Override
protected ClickHouseContainer createContainer() {
return new ClickHouseContainer("clickhouse/clickhouse-server:21.9.2-alpine");
return new ClickHouseContainer("clickhouse/clickhouse-server:21.11.11-alpine");
}
}
Loading