Repository: housepower/ClickHouse-Native-JDBC
Pull request #443 (2023-08-24 16:58:19)

[CLEANUP]: Update clickhouse libs & actualise benchmarks

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/housepower/ClickHouse-Native-JDBC/pull/443?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#443](https://app.codecov.io/gh/housepower/ClickHouse-Native-JDBC/pull/443?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (2bc831f) into [master](https://app.codecov.io/gh/housepower/ClickHouse-Native-JDBC/commit/21f2906d4b38b6aca361a3f97486304a7172b3d3?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (21f2906) will **not change** coverage.
> The diff coverage is `n/a`.

> :exclamation: Current head 2bc831f differs from pull request most recent head 5777930. Consider uploading reports for the commit 5777930 to get more accurate results

```diff
@@            Coverage Diff            @@
##             master     #443   +/-   ##
=========================================
  Coverage     62.99%   62.99%           
  Complexity     1263     1263           
=========================================
  Files           135      135           
  Lines          6662     6662           
  Branches        519      519           
=========================================
  Hits           4197     4197           
  Misses         2197     2197           
  Partials        268      268           
```




sundy-li: ```
Run github-actions-up-and-running/pr-comment@v1.0.1
[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
Error: Resource not accessible by integration
```

seems we need to upgrade the action in workflow.

Patch:
diff --git a/clickhouse-integration/clickhouse-integration-spark/pom.xml b/clickhouse-integration/clickhouse-integration-spark/pom.xml
index 14db9d1..df56a56 100644
--- a/clickhouse-integration/clickhouse-integration-spark/pom.xml
+++ b/clickhouse-integration/clickhouse-integration-spark/pom.xml
@@ -61,9 +61,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>ru.yandex.clickhouse</groupId>
+            <groupId>com.clickhouse</groupId>
             <artifactId>clickhouse-jdbc</artifactId>
-            <classifier>shaded</classifier>
+            <classifier>all</classifier>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/clickhouse-native-jdbc/pom.xml b/clickhouse-native-jdbc/pom.xml
index 7661a43..1c269a7 100644
--- a/clickhouse-native-jdbc/pom.xml
+++ b/clickhouse-native-jdbc/pom.xml
@@ -57,9 +57,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>ru.yandex.clickhouse</groupId>
+            <groupId>com.clickhouse</groupId>
             <artifactId>clickhouse-jdbc</artifactId>
-            <classifier>shaded</classifier>
+            <classifier>all</classifier>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/examples/pom.xml b/examples/pom.xml
index 31d4d02..7a68dd6 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -45,9 +45,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>ru.yandex.clickhouse</groupId>
+            <groupId>com.clickhouse</groupId>
             <artifactId>clickhouse-jdbc</artifactId>
-            <classifier>shaded</classifier>
+            <classifier>all</classifier>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/pom.xml b/pom.xml
index 9e2a549..70f7bf9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -115,7 +115,7 @@
         <alibaba.druid.version>1.2.4</alibaba.druid.version>
         <dbcp2.version>2.8.0</dbcp2.version>
         <jupiter.version>5.7.0</jupiter.version>
-        <testcontainers.version>1.15.1</testcontainers.version>
+        <testcontainers.version>1.19.0</testcontainers.version>
 
         <async-profiler.library-path>/tmp/async-profiler-1.8.3-linux-x64/build</async-profiler.library-path>
 
@@ -188,10 +188,11 @@
                 <version>${jmh.version}</version>
             </dependency>
             <dependency>
-                <groupId>ru.yandex.clickhouse</groupId>
+                <groupId>com.clickhouse</groupId>
                 <artifactId>clickhouse-jdbc</artifactId>
-                <classifier>shaded</classifier>
-                <version>${yandex-clickhouse-jdbc.version}</version>
+                <version>0.4.6</version>
+                <!-- use uber jar with all dependencies included, change classifier to http for smaller jar -->
+                <classifier>all</classifier>
                 <exclusions>
                     <exclusion>
                         <groupId>com.fasterxml.jackson.core</groupId>


Test patch:
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java
index 2ab78a4..7175d06 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java
@@ -17,7 +17,7 @@ package com.github.housepower.jdbc;
 import com.github.housepower.misc.StrUtil;
 import com.github.housepower.misc.SystemUtil;
 import org.junit.jupiter.api.BeforeAll;
-import org.testcontainers.containers.ClickHouseContainer;
+import org.testcontainers.clickhouse.ClickHouseContainer;
 import org.testcontainers.junit.jupiter.Container;
 import org.testcontainers.junit.jupiter.Testcontainers;
 import org.testcontainers.utility.MountableFile;
@@ -35,33 +35,32 @@ public abstract class AbstractITest implements Serializable {
     protected static final ZoneId SERVER_TZ = ZoneId.of("UTC");
     protected static final String DRIVER_CLASS_NAME = "com.github.housepower.jdbc.ClickHouseDriver";
 
-    public static final String CLICKHOUSE_IMAGE = System.getProperty("CLICKHOUSE_IMAGE", "yandex/clickhouse-server:21.9");
+    public static final String CLICKHOUSE_IMAGE = System.getProperty("CLICKHOUSE_IMAGE", "clickhouse/clickhouse-server:21.9");
 
     protected static final String CLICKHOUSE_USER = SystemUtil.loadProp("CLICKHOUSE_USER", "default");
     protected static final String CLICKHOUSE_PASSWORD = SystemUtil.loadProp("CLICKHOUSE_PASSWORD", "");
     protected static final String CLICKHOUSE_DB = SystemUtil.loadProp("CLICKHOUSE_DB", "");
 
     protected static final int CLICKHOUSE_GRPC_PORT = 9100;
+    protected static final int CLICKHOUSE_HTTP_PORT = 8123;
+    protected static final int CLICKHOUSE_NATIVE_PORT = 9000;
 
     @Container
-    public static ClickHouseContainer container = (ClickHouseContainer) new ClickHouseContainer(CLICKHOUSE_IMAGE)
+    public static ClickHouseContainer container = new ClickHouseContainer(CLICKHOUSE_IMAGE)
             .withEnv("CLICKHOUSE_USER", CLICKHOUSE_USER)
             .withEnv("CLICKHOUSE_PASSWORD", CLICKHOUSE_PASSWORD)
             .withEnv("CLICKHOUSE_DB", CLICKHOUSE_DB)
-            .withExposedPorts(CLICKHOUSE_GRPC_PORT)
+            .withExposedPorts(CLICKHOUSE_HTTP_PORT, CLICKHOUSE_NATIVE_PORT, CLICKHOUSE_GRPC_PORT)
             .withCopyFileToContainer(MountableFile.forClasspathResource("grpc_config.xml"), "/etc/clickhouse-server/config.d/grpc_config.xml");
 
-
     protected static String CK_HOST;
-    protected static String CK_IP;
     protected static int CK_PORT;
     protected static int CK_GRPC_PORT;
 
     @BeforeAll
     public static void extractContainerInfo() {
         CK_HOST = container.getHost();
-        CK_IP = container.getContainerIpAddress();
-        CK_PORT = container.getMappedPort(ClickHouseContainer.NATIVE_PORT);
+        CK_PORT = container.getMappedPort(CLICKHOUSE_NATIVE_PORT);
         CK_GRPC_PORT = container.getMappedPort(CLICKHOUSE_GRPC_PORT);
     }
 
@@ -74,7 +73,7 @@ public abstract class AbstractITest implements Serializable {
 
     protected String getJdbcUrl(Object... params) {
         StringBuilder sb = new StringBuilder();
-        int port = container.getMappedPort(ClickHouseContainer.NATIVE_PORT);
+        int port = container.getMappedPort(CLICKHOUSE_NATIVE_PORT);
         sb.append("jdbc:clickhouse://").append(container.getHost()).append(":").append(port);
         if (StrUtil.isNotEmpty(CLICKHOUSE_DB)) {
             sb.append("/").append(container.getDatabaseName());
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/BalancedClickhouseDataSourceITest.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/BalancedClickhouseDataSourceITest.java
index ad20a96..a5647b9 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/BalancedClickhouseDataSourceITest.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/BalancedClickhouseDataSourceITest.java
@@ -34,7 +34,7 @@ public class BalancedClickhouseDataSourceITest extends AbstractITest {
     @BeforeEach
     public void reset() {
         singleDs = new BalancedClickhouseDataSource(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s", CK_HOST, CK_PORT));
-        dualDs = new BalancedClickhouseDataSource(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s", CK_HOST, CK_PORT, CK_IP, CK_PORT));
+        dualDs = new BalancedClickhouseDataSource(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s", CK_HOST, CK_PORT, CK_HOST, CK_PORT));
     }
 
     @Test
@@ -121,7 +121,7 @@ public class BalancedClickhouseDataSourceITest extends AbstractITest {
     @Test
     public void testWorkWithEnabledUrl() throws Exception {
         BalancedClickhouseDataSource halfDatasource = new BalancedClickhouseDataSource(
-                String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s", "not.existed.url", CK_PORT, CK_IP, CK_PORT), new Properties());
+                String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s", "not.existed.url", CK_PORT, CK_HOST, CK_PORT), new Properties());
 
         halfDatasource.actualize();
 
@@ -173,7 +173,7 @@ public class BalancedClickhouseDataSourceITest extends AbstractITest {
 
         // without connection parameters
         BalancedClickhouseDataSource dataSource = new BalancedClickhouseDataSource(
-                String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s/click", CK_HOST, CK_PORT, CK_IP, CK_PORT), properties);
+                String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s/click", CK_HOST, CK_PORT, CK_HOST, CK_PORT), properties);
         ClickHouseConfig cfg = dataSource.getCfg();
         assertEquals(Duration.ofSeconds(6789), cfg.queryTimeout());
         assertEquals("888888", cfg.password());
@@ -181,12 +181,12 @@ public class BalancedClickhouseDataSourceITest extends AbstractITest {
         assertEquals(2, dataSource.getAllClickhouseUrls().size());
         assertEquals(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s/click", CK_HOST, CK_PORT),
                 dataSource.getAllClickhouseUrls().get(0));
-        assertEquals(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s/click", CK_IP, CK_PORT),
+        assertEquals(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s/click", CK_HOST, CK_PORT),
                 dataSource.getAllClickhouseUrls().get(1));
 
         // with connection parameters
         dataSource = new BalancedClickhouseDataSource(
-                String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s/click?query_timeout=12345&user=readonly", CK_HOST, CK_PORT, CK_IP, CK_PORT), properties);
+                String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s,%s:%s/click?query_timeout=12345&user=readonly", CK_HOST, CK_PORT, CK_HOST, CK_PORT), properties);
         cfg = dataSource.getCfg();
         assertEquals(Duration.ofSeconds(6789), cfg.queryTimeout());
         assertEquals("readonly", cfg.user());
@@ -195,7 +195,7 @@ public class BalancedClickhouseDataSourceITest extends AbstractITest {
         assertEquals(2, dataSource.getAllClickhouseUrls().size());
         assertEquals(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s/click?query_timeout=12345&user=readonly", CK_HOST, CK_PORT),
                 dataSource.getAllClickhouseUrls().get(0));
-        assertEquals(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s/click?query_timeout=12345&user=readonly", CK_IP, CK_PORT),
+        assertEquals(String.format(Locale.ROOT, "jdbc:clickhouse://%s:%s/click?query_timeout=12345&user=readonly", CK_HOST, CK_PORT),
                 dataSource.getAllClickhouseUrls().get(1));
     }
 }
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/AbstractIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/AbstractIBenchmark.java
index 0a3389a..bd010c0 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/AbstractIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/AbstractIBenchmark.java
@@ -20,7 +20,7 @@ import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.RunnerException;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
-import org.testcontainers.containers.ClickHouseContainer;
+import org.testcontainers.clickhouse.ClickHouseContainer;
 
 import java.sql.*;
 import java.util.Enumeration;
@@ -31,6 +31,12 @@ import java.util.concurrent.TimeUnit;
 @State(Scope.Thread)
 public class AbstractIBenchmark {
 
+    /*
+    * HTTP API Port for http requests. used by JDBC, ODBC and web interfaces.
+    * */
+    protected static final int CLICKHOUSE_HTTP_PORT = 8123;
+    protected static final int CLICKHOUSE_NATIVE_PORT = 9000;
+
     public static final ClickHouseContainer container;
 
     static {
@@ -38,7 +44,7 @@ public class AbstractIBenchmark {
         container.start();
     }
 
-    private final Driver httpDriver = new ru.yandex.clickhouse.ClickHouseDriver();
+    private final Driver clickhouseJdbcDriver = new com.clickhouse.jdbc.ClickHouseDriver();
     private final Driver nativeDriver = new com.github.housepower.jdbc.ClickHouseDriver();
 
     public static void main(String[] args) throws RunnerException {
@@ -64,13 +70,13 @@ public class AbstractIBenchmark {
             case NATIVE:
                 Class.forName("com.github.housepower.jdbc.ClickHouseDriver");
                 DriverManager.registerDriver(nativeDriver);
-                port = container.getMappedPort(ClickHouseContainer.NATIVE_PORT);
+                port = container.getMappedPort(CLICKHOUSE_NATIVE_PORT);
                 break;
 
-            case HTTP:
-                Class.forName("ru.yandex.clickhouse.ClickHouseDriver");
-                DriverManager.registerDriver(httpDriver);
-                port = container.getMappedPort(ClickHouseContainer.HTTP_PORT);
+            case JDBC:
+                Class.forName("com.clickhouse.jdbc.ClickHouseDriver");
+                DriverManager.registerDriver(clickhouseJdbcDriver);
+                port = container.getMappedPort(CLICKHOUSE_HTTP_PORT);
                 break;
 
             default:
@@ -111,6 +117,6 @@ public class AbstractIBenchmark {
     }
 
     public enum ConnectionType {
-        NATIVE, HTTP
+        NATIVE, JDBC
     }
 }
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryDoubleIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/DoubleIBenchmark.java
similarity index 70%
rename from clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryDoubleIBenchmark.java
rename to clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/DoubleIBenchmark.java
index c3fffc3..daf29cd 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryDoubleIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/DoubleIBenchmark.java
@@ -16,12 +16,10 @@ package com.github.housepower.jdbc.benchmark;
 
 import com.google.common.base.Strings;
 import org.openjdk.jmh.annotations.Benchmark;
-import ru.yandex.clickhouse.ClickHouseStatement;
-import ru.yandex.clickhouse.domain.ClickHouseFormat;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-public class RowBinaryDoubleIBenchmark extends AbstractInsertIBenchmark {
+public class DoubleIBenchmark extends AbstractInsertIBenchmark {
     private final String columnType = "Float64";
 
     @Benchmark
@@ -46,20 +44,23 @@ public class RowBinaryDoubleIBenchmark extends AbstractInsertIBenchmark {
     }
 
     @Benchmark
-    public void benchInsertHttpRowBinary() throws Exception {
+    public void benchInsertJdbc() throws Exception {
         withConnection(connection -> {
             wideColumnPrepare(connection, columnType);
-            withStatement(connection, stmt -> {
-                ClickHouseStatement sth = (ClickHouseStatement) stmt;
-                sth.write().send("INSERT INTO " + getTableName(), stream -> {
-                    for (int i = 0; i < batchSize; i++) {
-                        for (int j = 0; j < columnNum; j++) {
-                            stream.writeFloat64(j + 1.0);
+            String params = Strings.repeat("?, ", columnNum);
+            withPreparedStatement(connection,
+                    "INSERT INTO " + getTableName() + " values(" + params.substring(0, params.length() - 2) + ")",
+                    pstmt -> {
+                        for (int i = 0; i < batchSize; i++) {
+                            for (int j = 0; j < columnNum; j++) {
+                                pstmt.setDouble(j + 1, j + 1.0);
+                            }
+                            pstmt.addBatch();
                         }
-                    }
-                }, ClickHouseFormat.RowBinary);
-            });
+                        int[] res = pstmt.executeBatch();
+                        assertEquals(res.length, batchSize);
+                    });
             wideColumnAfter(connection);
-        }, ConnectionType.HTTP);
+        }, ConnectionType.JDBC);
     }
 }
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/InsertIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/InsertIBenchmark.java
index 0a71d43..6abc865 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/InsertIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/InsertIBenchmark.java
@@ -61,7 +61,7 @@ public class InsertIBenchmark extends AbstractInsertIBenchmark {
     }
 
     @Benchmark
-    public void benchInsertHttp() throws Exception {
-        withConnection(benchInsert, ConnectionType.HTTP);
+    public void benchInsertJdbc() throws Exception {
+        withConnection(benchInsert, ConnectionType.JDBC);
     }
 }
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryIntIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/IntIBenchmark.java
similarity index 70%
rename from clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryIntIBenchmark.java
rename to clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/IntIBenchmark.java
index fea1877..62978a1 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryIntIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/IntIBenchmark.java
@@ -16,12 +16,10 @@ package com.github.housepower.jdbc.benchmark;
 
 import com.google.common.base.Strings;
 import org.openjdk.jmh.annotations.Benchmark;
-import ru.yandex.clickhouse.ClickHouseStatement;
-import ru.yandex.clickhouse.domain.ClickHouseFormat;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-public class RowBinaryIntIBenchmark extends AbstractInsertIBenchmark {
+public class IntIBenchmark extends AbstractInsertIBenchmark {
     private final String columnType = "Int32";
 
     @Benchmark
@@ -46,21 +44,24 @@ public class RowBinaryIntIBenchmark extends AbstractInsertIBenchmark {
     }
 
     @Benchmark
-    public void benchInsertHttpRowBinary() throws Exception {
+    public void benchInsertJdbc() throws Exception {
         withConnection(connection -> {
             wideColumnPrepare(connection, columnType);
-            withStatement(connection, stmt -> {
-                ClickHouseStatement sth = (ClickHouseStatement) stmt;
-                sth.write().send("INSERT INTO " + getTableName(), stream -> {
-                    for (int i = 0; i < batchSize; i++) {
-                        for (int j = 0; j < columnNum; j++) {
-                            stream.writeInt32(j + 1);
+            String params = Strings.repeat("?, ", columnNum);
+            withPreparedStatement(connection,
+                    "INSERT INTO " + getTableName() + " values(" + params.substring(0, params.length() - 2) + ")",
+                    pstmt -> {
+                        for (int i = 0; i < batchSize; i++) {
+                            for (int j = 0; j < columnNum; j++) {
+                                pstmt.setObject(j + 1, j + 1);
+                            }
+                            pstmt.addBatch();
                         }
-                    }
-                }, ClickHouseFormat.RowBinary);
-            });
+                        int[] res = pstmt.executeBatch();
+                        assertEquals(res.length, batchSize);
+                    });
             wideColumnAfter(connection);
-        }, ConnectionType.HTTP);
+        }, ConnectionType.JDBC);
     }
 
 }
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/SelectIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/SelectIBenchmark.java
index 7630443..41360ba 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/SelectIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/SelectIBenchmark.java
@@ -47,7 +47,7 @@ public class SelectIBenchmark extends AbstractIBenchmark {
     }
 
     @Benchmark
-    public void benchSelectHTTP() throws Exception {
-        withConnection(benchSelect, ConnectionType.HTTP);
+    public void benchSelectJdbc() throws Exception {
+        withConnection(benchSelect, ConnectionType.JDBC);
     }
 }
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryStringIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/StringIBenchmark.java
similarity index 70%
rename from clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryStringIBenchmark.java
rename to clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/StringIBenchmark.java
index 997991c..fa1e5f1 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/RowBinaryStringIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/StringIBenchmark.java
@@ -16,12 +16,10 @@ package com.github.housepower.jdbc.benchmark;
 
 import com.google.common.base.Strings;
 import org.openjdk.jmh.annotations.Benchmark;
-import ru.yandex.clickhouse.ClickHouseStatement;
-import ru.yandex.clickhouse.domain.ClickHouseFormat;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-public class RowBinaryStringIBenchmark extends AbstractInsertIBenchmark {
+public class StringIBenchmark extends AbstractInsertIBenchmark {
     private final String columnType = "String";
 
     @Benchmark
@@ -46,21 +44,24 @@ public class RowBinaryStringIBenchmark extends AbstractInsertIBenchmark {
     }
 
     @Benchmark
-    public void benchInsertHttpRowBinary() throws Exception {
+    public void benchInsertJdbc() throws Exception {
         withConnection(connection -> {
             wideColumnPrepare(connection, columnType);
-            withStatement(connection, stmt -> {
-                ClickHouseStatement sth = (ClickHouseStatement) stmt;
-                sth.write().send("INSERT INTO " + getTableName(), stream -> {
-                    for (int i = 0; i < batchSize; i++) {
-                        for (int j = 0; j < columnNum; j++) {
-                            stream.writeString(j + 1 + "");
+            String params = Strings.repeat("?, ", columnNum);
+            withPreparedStatement(connection,
+                    "INSERT INTO " + getTableName() + " values(" + params.substring(0, params.length() - 2) + ")",
+                    pstmt -> {
+                        for (int i = 0; i < batchSize; i++) {
+                            for (int j = 0; j < columnNum; j++) {
+                                pstmt.setObject(j + 1, j + 1 + "");
+                            }
+                            pstmt.addBatch();
                         }
-                    }
-                }, ClickHouseFormat.RowBinary);
-            });
+                        int[] res = pstmt.executeBatch();
+                        assertEquals(res.length, batchSize);
+                    });
             wideColumnAfter(connection);
-        }, ConnectionType.HTTP);
+        }, ConnectionType.JDBC);
     }
 
 }
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnDoubleInsertIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnDoubleInsertIBenchmark.java
index 70ee015..59e31dd 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnDoubleInsertIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnDoubleInsertIBenchmark.java
@@ -27,8 +27,8 @@ public class WideColumnDoubleInsertIBenchmark extends AbstractInsertIBenchmark {
     }
 
     @Benchmark
-    public void benchInsertHttp() throws Exception {
-        withConnection(benchInsert, ConnectionType.HTTP);
+    public void benchInsertJdbc() throws Exception {
+        withConnection(benchInsert, ConnectionType.JDBC);
     }
 
     public WithConnection benchInsert = connection -> {
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnIntInsertIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnIntInsertIBenchmark.java
index f687af3..4154e3c 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnIntInsertIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnIntInsertIBenchmark.java
@@ -27,8 +27,8 @@ public class WideColumnIntInsertIBenchmark extends AbstractInsertIBenchmark {
     }
 
     @Benchmark
-    public void benchInsertHttp() throws Exception {
-        withConnection(benchInsert, ConnectionType.HTTP);
+    public void benchInsertJdbc() throws Exception {
+        withConnection(benchInsert, ConnectionType.JDBC);
     }
 
     public WithConnection benchInsert = connection -> {
diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnStringInsertIBenchmark.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnStringInsertIBenchmark.java
index 89f89e5..4eb4055 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnStringInsertIBenchmark.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/benchmark/WideColumnStringInsertIBenchmark.java
@@ -27,8 +27,8 @@ public class WideColumnStringInsertIBenchmark extends AbstractInsertIBenchmark {
     }
 
     @Benchmark
-    public void benchInsertHttp() throws Exception {
-        withConnection(benchInsert, ConnectionType.HTTP);
+    public void benchInsertJdbc() throws Exception {
+        withConnection(benchInsert, ConnectionType.JDBC);
     }
 
     public WithConnection benchInsert = connection -> {