1
votes

i'm using phoenix combine with jdbcTemplate to insert data to Hbase.

  • Phoenix4.7.0
  • Hbase 1.1.2

One of the column(id) in the table is generated monotonically with a sequence,in general,i use "jdbcTemplate.execute(sql)" method to insert data. For example , "upsert into table(row id) values( "row"," NEXT VALUE FOR table.id_sequence" )" The second column(id) is generated Automatically with a sequence. it's fine.But when i use "jdbcTemplate.batchUpdate" method ,the same sql to batchInsert,there's something wrong with it.

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

How can i fix it?

1
It says type mismatch, so the inserted value is not in sync with the datatype that column accepts. Could you post the code with some data samples? Have a look at the link, they have diagnosed the same issue caused by the like operator. issues.apache.org/jira/browse/PHOENIX-1938xCodeZone
! think u very much , i solved it! while i restart the projectZ.xie
Glad you did. Keep learning! Cheers!!xCodeZone

1 Answers

0
votes

Please add hbase-protocol.jar in classpath. So that it is available to program..

Please reply me if in case any issue.