Skip to content

Commit 951543b

Browse files
author
Paultagoras
committed
Merge branch 'add-jdbc-benchmarking' of https://github.com/ClickHouse/clickhouse-java into add-jdbc-benchmarking
2 parents fd9a186 + 779701e commit 951543b

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

performance/src/test/com/clickhouse/benchmark/clients/BenchmarkBase.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.clickhouse.client.ClickHouseNodeSelector;
1212
import com.clickhouse.client.ClickHouseProtocol;
1313
import com.clickhouse.client.ClickHouseResponse;
14+
import com.clickhouse.client.ClickHouseServerForTest;
1415
import com.clickhouse.client.api.Client;
1516
import com.clickhouse.client.api.ConnectionReuseStrategy;
1617
import com.clickhouse.client.api.enums.Protocol;
@@ -56,11 +57,10 @@
5657
@State(Scope.Benchmark)
5758
public class BenchmarkBase {
5859
private static final Logger LOGGER = LoggerFactory.getLogger(BenchmarkBase.class);
59-
6060
protected ClickHouseClient clientV1;
6161
protected Client clientV2;
62-
protected static Connection jdbcV1 = null;
63-
protected static Connection jdbcV2 = null;
62+
protected static Connection jdbcV1;
63+
protected static Connection jdbcV2;
6464

6565
@Setup(Level.Iteration)
6666
public void setUpIteration() {
@@ -265,14 +265,13 @@ protected static Client getClientV2(boolean includeDb) {
265265
.setDefaultDatabase(includeDb ? DB_NAME : "default")
266266
.build();
267267
}
268-
268+
269269
protected static Connection getJdbcV1() {
270270
Properties properties = new Properties();
271271
properties.put("user", getUsername());
272272
properties.put("password", getPassword());
273-
273+
274274
ClickHouseNode node = getServer();
275-
LOGGER.info("clickhouse endpoint [{}:{}]", node.getHost(), node.getPort());
276275
Connection jdbcV1 = null;
277276
try {
278277
jdbcV1 = new ClickHouseDriver().connect(String.format("jdbc:clickhouse://%s:%s?clickhouse.jdbc.v1=true", node.getHost(), node.getPort()), properties);
@@ -281,21 +280,20 @@ protected static Connection getJdbcV1() {
281280
}
282281
return jdbcV1;
283282
}
284-
285-
protected static Connection getJdbcV2() {
283+
284+
protected static Connection getJdbcV2() throws SQLException {
286285
Properties properties = new Properties();
287286
properties.put("user", getUsername());
288287
properties.put("password", getPassword());
289288

290289
ClickHouseNode node = getServer();
291-
LOGGER.info("clickhouse endpoint [{}:{}]", node.getHost(), node.getPort());
292-
293290
Connection jdbcV2 = null;
294291
try {
295292
jdbcV2 = new ClickHouseDriver().connect(String.format("jdbc:clickhouse://%s:%s", node.getHost(), node.getPort()), properties);
296293
} catch (SQLException e) {
297294
LOGGER.error(e.getMessage());
298295
}
296+
299297
return jdbcV2;
300298
}
301299

0 commit comments

Comments
 (0)