一、该问题的重现步骤是什么?
BladeX-Links合并1.1.0版本代码后,启动Server后提示:
2024-09-25 10:14:07.212 INFO 17960 --- [ main] o.s.i.t.tdengine.dao.TDEngineTemplate : TdEngine create database sql:CREATE DATABASE IF NOT EXISTS links PRECISION 'ms' CACHEMODEL 'last_value' KEEP 3650 DURATION 10 BUFFER 16 WAL_LEVEL 1
2024-09-25 10:14:08.351 INFO 17960 --- [ main] o.s.i.t.tdengine.dao.TDEngineTemplate : TdEngine create STable sql:CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));
2024-09-25 10:14:08.354 INFO 17960 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-2} inited
2024-09-25 10:14:08.408 ERROR 17960 --- [ main] o.s.i.t.tdengine.dao.TDEngineTemplate : TdEngine create STable error
org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));]; SQL state []; error code [9794]; TDengine ERROR (0x2642): sql: CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));, desc: Invalid binary/nchar column length
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1549)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:408)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:444)
at org.springblade.iot.tsdb.tdengine.dao.TDEngineTemplate.createSTable(TDEngineTemplate.java:318)
at org.springblade.iot.tsdb.tdengine.dao.TDEngineTemplate.afterSingletonsInstantiated(TDEngineTemplate.java:449)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:986)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:149)
at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:49)
at org.springblade.mqtt.broker.BrokerApplication.main(BrokerApplication.java:43)
Caused by: java.sql.SQLException: TDengine ERROR (0x2642): sql: CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));, desc: Invalid binary/nchar column length
at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:95)
at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:97)
at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:78)
at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:635)
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:435)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:393)
... 13 common frames omitted
二、你期待的结果是什么?实际看到的又是什么?
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
使用BladeX-Links,更新到1.1.0版本
四、请提供详细的错误堆栈信息,这很重要。
五、若有更多详细信息,请在下面提供。
报的错误是这个:
desc: Invalid binary/nchar column length
超出设定的字段长度了,你的productKey和topic长度分别是多少。
topic长度设定的是128,productKey和deviceName是64。如果确实超出了,可以自行修改一下tdengie的封装模块,放大字段的长度
具体在哪改的呢
在红框的类,其他的字段长度以此类推
这是productKey和deviceName
改了还是报错,你们用的是哪个版本的
3.3.0.3 Community
扫一扫访问 Blade技术社区 移动端