You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "endcy (via GitHub)" <gi...@apache.org> on 2023/04/26 07:29:28 UTC

[GitHub] [iotdb] endcy opened a new issue, #9709: [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败

endcy opened a new issue, #9709:
URL: https://github.com/apache/iotdb/issues/9709

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.
   
   
   ### Version
   
   iotdb:1.0.0  buildInfo:fbbca3f-dev  (show version)
   其它:
   iotdb-jdbc:1.0.0
   mybatis-spring-boot-starter:2.2.0
   mybatis:3.5.7
   mybatis-spring:2.0.6
   
   
   ### Describe the bug and provide the minimal reproduce step
   
   -- 整合mybatis的DataSource配置
   spring.datasource.username=xxx
   spring.datasource.password=xxx
   spring.datasource.driver-class-name = org.apache.iotdb.jdbc.IoTDBDriver
   spring.datasource.driverClassName = org.apache.iotdb.jdbc.IoTDBDriver
   spring.datasource.jdbc-url=jdbc:iotdb://xxx:6667/
   spring.datasource.url=jdbc:iotdb://xxx:6667/
   mybatis.mapper-locations=classpath*:/mappers/*.xml
   
   -- entity
       private Long timestamp;
       private Long orderId;
       private Integer orderNum;
       private String orderName;
       private String createTime;
   
   -- 以order作为示例时序实体,mapper xml中部分statement如下
   
       <select id="queryOrder" resultMap="BaseResultMap">
           select * from root.order.orderdetail limit 3 offset 0
       </select>
   
       <insert id="createOrder" parameterType="com.test.iotdb.entity.OrderInfo">
           insert into root.order.orderdetail(timestamp, order_id, order_num, create_time, order_name)
           values ( #{timestamp}, #{orderId}, #{orderNum}, #{createTime,jdbcType=VARCHAR,javaType=java.lang.String}, #{orderName,jdbcType=VARCHAR,javaType=java.lang.String} );
       </insert>
   
   -- 时序结构
   SET STORAGE GROUP TO root.order;
   CREATE TIMESERIES root.order.orderdetail.order_id WITH DATATYPE=INT64, ENCODING=PLAIN, COMPRESSOR=SNAPPY;
   CREATE TIMESERIES root.order.orderdetail.order_num WITH DATATYPE=INT32, ENCODING=PLAIN, COMPRESSOR=SNAPPY;
   CREATE TIMESERIES root.order.orderdetail.order_name WITH DATATYPE=TEXT, ENCODING=PLAIN, COMPRESSOR=SNAPPY;
   CREATE TIMESERIES root.order.orderdetail.create_time WITH DATATYPE=TEXT, ENCODING=PLAIN, COMPRESSOR=SNAPPY;
   
   ### What did you expect to see?
   
   query方法和insert方法应该包含在最小sql集中,这里应该sql正常赋值正确,时序数据成功保存/查询出映射的信息
   
   ### What did you see instead?
   
   增加时序create/insert时失败,string预处理时缺少引号,使用
   insert into root.order.orderdetail( order_id, order_num, order_name, create_time) values (1682244729014, 10004, 1, 实体测试4,aaa4);
   
   2023-04-26 14:43:36.831  INFO 21076 --- [nio-9015-exec-4] c.test.iotdb.rest.OrderController   : 创建失败!org.springframework.jdbc.UncategorizedSQLException: 
   ### Error updating database.  Cause: org.apache.iotdb.jdbc.IoTDBSQLException: 700: Error occurred while parsing SQL to physical plan: line 2:57 no viable alternative at input '( 1682491416531, 10011, 11, '2023-04-26', 中文名称13'
   ### The error may exist in file [E:\projects\ces-iotdb\target\classes\mapper\OrderMapper.xml]
   ### The error may involve com.test.iotdb.mapper.OrderMapper.createOrder-Inline
   ### The error occurred while setting parameters
   ### SQL: insert into root.order.orderdetail(timestamp, order_id, order_num, create_time, order_name)         values ( ?, ?, ?, ?, ? );
   ### Cause: org.apache.iotdb.jdbc.IoTDBSQLException: 700: Error occurred while parsing SQL to physical plan: line 2:57 no viable alternative at input '( 1682491416531, 10011, 11, '2023-04-26', 中文名称13'
   ; uncategorized SQLException; SQL state [Error occurred while parsing SQL to physical plan: line 2:57 no viable alternative at input '( 1682491416531, 10011, 11, '2023-04-26', 中文名称13']; error code [700]; 700: Error occurred while parsing SQL to physical plan: line 2:57 no viable alternative at input '( 1682491416531, 10011, 11, '2023-04-26', 中文名称13'; nested exception is org.apache.iotdb.jdbc.IoTDBSQLException: 700: Error occurred while parsing SQL to physical plan: line 2:57 no viable alternative at input '( 1682491416531, 10011, 11, '2023-04-26', 中文名称13'
   
   ### Anything else?
   
   查询成功,IoTDBStatement异常
   java.sql.SQLException: Not support getMaxFieldSize
   	at org.apache.iotdb.jdbc.IoTDBStatement.getMaxFieldSize(IoTDBStatement.java:624) ~[iotdb-jdbc-1.0.1.jar:1.0.1]
   	at com.alibaba.druid.pool.DruidPooledPreparedStatement.<init>(DruidPooledPreparedStatement.java:66) ~[druid-1.2.16.jar:na]
   	at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:371) [druid-1.2.16.jar:na]
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:86) [mybatis-3.5.7.jar:3.5.7]
   -- 查询后数据打印
   OrderInfo(timestamp=null, orderId=10001, orderNum=1, orderName=实体测试1, createTime=aaa)
   
   很感谢阅读,同时希望能出一些简单整合框架的教程(基于封装的学习成本,想把mybatis当过渡工具),能很大程度减少入门使用门槛。感谢!
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败 [iotdb]

Posted by "endcy (via GitHub)" <gi...@apache.org>.
endcy commented on issue #9709:
URL: https://github.com/apache/iotdb/issues/9709#issuecomment-2197884632

   The insertion time sequence can be solved by using "session ApiConfiguration. getSessionPool(). insertRecord" in the iotdb-session tool; Or perhaps adding single quotes to the string value, such as replacing abc with 'abc', maybe can also solve the problem, but the results of orm query method should be processed accordingly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败 [iotdb]

Posted by "endcy (via GitHub)" <gi...@apache.org>.
endcy closed issue #9709: [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败
URL: https://github.com/apache/iotdb/issues/9709


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败 [iotdb]

Posted by "zhen88132-lang (via GitHub)" <gi...@apache.org>.
zhen88132-lang commented on issue #9709:
URL: https://github.com/apache/iotdb/issues/9709#issuecomment-4124120227

   2026-03-25 14:13:24.092 [http-nio-48080-exec-6] ERROR c.alibaba.druid.pool.DruidPooledPreparedStatement:68 - getMaxFieldSize error
   java.sql.SQLException: Not support getMaxFieldSize
   	at org.apache.iotdb.jdbc.IoTDBStatement.getMaxFieldSize(IoTDBStatement.java:604)
   	at com.alibaba.druid.pool.DruidPooledPreparedStatement.<init>(DruidPooledPreparedStatement.java:66)
   	at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:378)
   	at jdk.internal.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
   	at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:53)
   	at jdk.proxy3/jdk.proxy3.$Proxy459.prepareStatement(Unknown Source)。当前最新版本


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] jixuan1989 commented on issue #9709: [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败

Posted by "jixuan1989 (via GitHub)" <gi...@apache.org>.
jixuan1989 commented on issue #9709:
URL: https://github.com/apache/iotdb/issues/9709#issuecomment-1593151339

   @qiaojialin have a look.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] github-actions[bot] commented on issue #9709: [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9709:
URL: https://github.com/apache/iotdb/issues/9709#issuecomment-1522921412

   Hi, this is your first issue in IoTDB project. Thanks for your report. Welcome to join the community!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] HTHou commented on issue #9709: [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败

Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on issue #9709:
URL: https://github.com/apache/iotdb/issues/9709#issuecomment-1709425970

   https://github.com/apache/iotdb/pull/3249 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] 使用Mybatis时IoTDBPreparedStatement中的setString字符串预处理失败 [iotdb]

Posted by "endcy (via GitHub)" <gi...@apache.org>.
endcy commented on issue #9709:
URL: https://github.com/apache/iotdb/issues/9709#issuecomment-2224327460

   > The insertion time sequence can be solved by using "session ApiConfiguration. getSessionPool(). insertRecord" in the iotdb-session tool; Or perhaps adding single quotes to the string value, such as replacing abc with 'abc', maybe can also solve the problem, but the results of orm query method should be processed accordingly.
   [usage of mybatis](https://github.com/endcy/fcwenergy/tree/main/iotdb-mybatis-core)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org