taosdata / TDengine

High-performance, scalable time-series database designed for Industrial IoT (IIoT) scenarios
https://tdengine.com
GNU Affero General Public License v3.0
23.39k stars 4.86k forks source link

BigDecimal类型插入报错SQLFeatureNotSupportedException #27690

Closed Lyxn3717 closed 2 months ago

Lyxn3717 commented 2 months ago

Bug Description taos-jdbcdriver是3.3.0 对于BigDecimal类型数据,查询没有问题,插入会报错,如下:

To Reproduce Caused by: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='planPower', mode=IN, javaType=class java.math.BigDecimal, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLFeatureNotSupportedException: this operation is NOT supported currently! at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:92) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:97) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:65) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:91) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.5.14.jar:3.5.14] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) ~[mybatis-3.5.14.jar:3.5.14] at jdk.proxy2/jdk.proxy2.$Proxy130.update(Unknown Source) ~[na:na] at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184) ~[mybatis-3.5.14.jar:3.5.14] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:425) ~[mybatis-spring-3.0.3.jar:3.0.3] ... 11 common frames omitted Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLFeatureNotSupportedException: this operation is NOT supported currently! at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:76) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:90) ~[mybatis-3.5.14.jar:3.5.14] ... 30 common frames omitted Caused by: java.sql.SQLFeatureNotSupportedException: this operation is NOT supported currently! at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:80) ~[taos-jdbcdriver-3.3.0.jar:na] at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:74) ~[taos-jdbcdriver-3.3.0.jar:na] at com.taosdata.jdbc.rs.RestfulPreparedStatement.setBigDecimal(RestfulPreparedStatement.java:125) ~[taos-jdbcdriver-3.3.0.jar:na] at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setBigDecimal(HikariProxyPreparedStatement.java) ~[HikariCP-5.1.0.jar:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:67) ~[mybatis-3.5.14.jar:3.5.14] at jdk.proxy3/jdk.proxy3.$Proxy131.setBigDecimal(Unknown Source) ~[na:na] at org.apache.ibatis.type.BigDecimalTypeHandler.setNonNullParameter(BigDecimalTypeHandler.java:32) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.type.BigDecimalTypeHandler.setNonNullParameter(BigDecimalTypeHandler.java:27) ~[mybatis-3.5.14.jar:3.5.14] at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:74) ~[mybatis-3.5.14.jar:3.5.14] ... 31 common frames omitted

Lyxn3717 commented 2 months ago

在mysql的驱动中,数据库类型是 float或double或decimal,但是都可以用BigDecimal声明,读写都没有问题。希望TD的驱动也可以支持一下!目前插入BigDecimal数据不支持。