schemaless insert in TDengine using jdbc connector

52 Views Asked by At

I tried to do a schemaless insert by using TDengine JDBC connector, but got following error

java.sql.SQLException: TDengine ERROR (2350): failed to insertLines
        at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:76)
        at com.taosdata.jdbc.TSDBJNIConnector.insertLines(TSDBJNIConnector.java:366)
        at com.taosdata.jdbc.SchemalessWriter.write(SchemalessWriter.java:35)
        at com.taosdata.jdbc.SchemalessInsertTest.schemalessInsert(SchemalessInsertTest.java:39)

my code is as follows

String[] lines = new String[]{
                "stb,t1=35 json_test=L\"{\"carNumber\":\"\",\"image\":\"\",\"outParkingSpace\":1638927251000,\"parkingSpaceStatus\":0}\" 1645329601000000000"};
        // when
        SchemalessWriter writer = new SchemalessWriter(conn);
        writer.write(lines, SchemalessProtocolType.LINE, SchemalessTimestampType.NANO_SECONDS);

        // then
        Statement statement = conn.createStatement();
        ResultSet rs = statement.executeQuery("show tables");

but the code works if I remove

"carNumber":"","image":"",

in json_test, any idea why I got this error?

1

There are 1 best solutions below

0
Shuduo On

works to me with version 2.4.0.12, you can try it.