Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

参数绑定写入数据,报column type mis-match with buffer type #29303

Open
dudan57 opened this issue Dec 24, 2024 · 0 comments
Open

参数绑定写入数据,报column type mis-match with buffer type #29303

dudan57 opened this issue Dec 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dudan57
Copy link

dudan57 commented Dec 24, 2024

Bug Description
TDengine版本号:3.3.2.0
场景:参数绑定,通过Java原生连接写入数据(https://docs.taosdata.com/develop/stmt/)
问题描述:超级表的字段类型为SMALLINT UNSIGNED,Java的类型使用的是Short,写入时报错: “java.sql.SQLException: TDengine ERROR (0x80000200): failed to bind column data, reason: column type mis-match with buffer type”。
超级表的字段类型为SMALLINT,Java类型使用Short,经测试写入没问题的。

To Reproduce
1、字段定义:
TDengine表字段:real_time_charge_watt SMALLINT UNSIGNED
Java字段: private Integer realTimeChargeWatt;
2、java代码:
ArrayList realTimeChargeWattList = new ArrayList<>();
for (int j = 0; j < numOfRow; j++)
realTimeChargeWattList.add(integerToShort(list.get(j).getRealTimeChargeWatt()));
pstmt.setShort(1, realTimeChargeWattList);

3、运行代码 pstmt.columnDataAddBatch();报错

Expected Behavior
TDengine的SMALLINT UNSIGNED类型对应Java的类型如果是Short,那这可能是个bug,需要修复,如果对应Java的类型不是Short,请告知Java对应的是什么类型?

Screenshots
image

Environment (please complete the following information):

  • OS: CentOS Linux release 7.6.1810
  • TDengine Version : 3.3.2.0
@dudan57 dudan57 added the bug Something isn't working label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant