我使用phoenix结合jdbcTemplate将数据插入Hbase。
表中的一个列(id)是用序列单调生成的,一般来说,我使用" jdbcTemplate.execute(sql)"插入数据的方法。 例如," upsert into table(row id)values(" row"," NEXT VALUE FOR table.id_sequence")"第二列(id)是使用序列自动生成的。没关系。但是当我使用" jdbcTemplate.batchUpdate"方法,同样的sql到batchInsert,它有问题。
Caused by: org.apache.phoenix.exception.BatchUpdateExecution: ERROR 1106 (XCL06): Exception while executing batch.
at org.apache.phoenix.jdbc.PhoenixStatement.executeBatch(PhoenixStatement.java:1226)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:905)
at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:890)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
... 45 more
Caused by: org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type mismatch. BIGINT and VARCHAR for NEXT VALUE FOR AQMDATA_ALL.id_sequence
我该如何解决?
答案 0 :(得分:0)
请在classpath中添加hbase-protocol.jar。所以它可用于程序..
如有任何问题,请回复我。