Code Monkey home page Code Monkey logo

Comments (4)

timorDevp avatar timorDevp commented on August 21, 2024 1

I'm also having this problem, can tell me how did you solve it, thank you

from clickhouse-java.

serebrserg avatar serebrserg commented on August 21, 2024

Hello.
Here is the test showing that 30 columns makes no problem for jdbc driver (it works).
There are many things going on in your example like JdbcRecordWriter and properties provider. There may be some restrictions in them.
If it is not, and the problem is indeed in the driver, could you provide the test case with direct use of jdbc api?

@Test
    public void test40() throws SQLException {
        int fieldsNum = 40;
        int rowsNum = 10;
        connection.createStatement().execute("DROP TABLE IF EXISTS test.test_40");
        List<String> fieldsDesc = new ArrayList<String>();
        List<String> fields = new ArrayList<String>();
        List<String> questions = new ArrayList<String>();
        for (int i = 0; i < fieldsNum; i++) {
            fieldsDesc.add("field" + i + " UInt32");
            fields.add("field" + i);
            questions.add("?");
        }
        connection.createStatement().execute(
                "CREATE TABLE IF NOT EXISTS test.test_40 (" + Joiner.on(",").join(fieldsDesc)  + ") ENGINE = TinyLog"
        );
        PreparedStatement statement = connection.prepareStatement("insert into test.test_40 ("+ Joiner.on(",").join(fields) + ") values (" + Joiner.on(",").join(questions) + ")" );
        for (int j = 0; j < rowsNum; j++) {
            for (int i = 0; i < fieldsNum; i++) {
                statement.setInt(i +1, i + 100*j);
            }
            statement.addBatch();
        }
        statement.executeBatch();
        
        ResultSet rs = connection.createStatement().executeQuery("select * from test.test_40");
        while (rs.next()) {
            System.out.println("next");
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < fieldsNum; i++) {
                sb.append(rs.getInt(i+1)).append(";");
            }
            System.out.println(sb.toString());
        }
    }

from clickhouse-java.

greysap avatar greysap commented on August 21, 2024

Hello. Thank you for response.
I had tried batch insert of 30+ columns with Spring jdbcTemplate+driver and it works without errors.
So it is definitely not a JDBC driver issue.

from clickhouse-java.

yangyongyongyong avatar yangyongyongyong commented on August 21, 2024

输出到clickhouse(jdbc)的多个字段,每个字段值都不允许是null,否则报错如此.

from clickhouse-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.