Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

It is hoped that the executeBatch() method within the Statement class will be supported. #459

Open
Tiakon opened this issue Mar 4, 2024 · 0 comments

Comments

@Tiakon
Copy link

Tiakon commented Mar 4, 2024

Environment

  • OS version: win7
  • JDK version:jdk1.8.0_191
  • ClickHouse Server version: 21.8.9.13 (official build).
  • ClickHouse Native JDBC version:2.6.5

Error logs

java.sql.SQLFeatureNotSupportedException
	at com.github.housepower.jdbc.wrapper.SQLStatement.addBatch(SQLStatement.java:170)
	at com.xxxx.yyyy.mirror.task.ClickhouseJdbcService.batchInsertWithList(ClickhouseJdbcService.java:25)
	at com.xxxx.yyyy.mirror.task.ClickhouseJdbcServiceTest.batchInsertWithListTest(ClickhouseJdbcServiceTest.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

Steps to reproduce

     public void batchInsertWithList(List<String> sqlFile) throws SQLException {
        final Connection connection = clickHouseJavaClient.getConnection();
        final Statement statement = connection.createStatement();
        for (int i = 0; i < sqlFile.size(); i++) {
            statement.addBatch(sqlFile.get(i));
            if ((i + 1) % maxRecordInBatch == 0) executeBatchCommit(statement);
        }
        executeBatchCommit(statement);
    }
    private void executeBatchCommit(Statement statement) throws SQLException {
        int[] updateCounts = statement.executeBatch();
        logger.info(format);
    }

Other descriptions

It is desired that the executeBatch() method within the Statement class be supported.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant