mybatis的Mapper.xml中如下:
in中的参数大概有1万6千多个,分成每1000个一组拼接成sql,然而在达梦中执行时报如下:
Caused by: dm.jdbc.driver.DMException: Invalid sequence no
at dm.jdbc.driver.DBError.throwException(DBError.java:710) ~[DmJdbcDriver18-8.1.1.193.jar:- 8.1.1.193 - Production]
at dm.jdbc.driver.DmdbPreparedStatement.prepareBindInParam(DmdbPreparedStatement.java:608) ~[DmJdbcDriver18-8.1.1.193.jar:- 8.1.1.193 - Production]
at dm.jdbc.driver.DmdbPreparedStatement.do_setString(DmdbPreparedStatement.java:770) ~[DmJdbcDriver18-8.1.1.193.jar:- 8.1.1.193 - Production]
at dm.jdbc.driver.DmdbPreparedStatement.setString(DmdbPreparedStatement.java:1665) ~[DmJdbcDriver18-8.1.1.193.jar:- 8.1.1.193 - Production]
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_setString(FilterChainImpl.java:3338) ~[druid-1.2.11.jar:1.2.11]
at com.alibaba.druid.filter.FilterAdapter.preparedStatement_setString(FilterAdapter.java:1346) ~[druid-1.2.11.jar:1.2.11]
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_setString(FilterChainImpl.java:3335) ~[druid-1.2.11.jar:1.2.11]
at com.alibaba.druid.filter.FilterAdapter.preparedStatement_setString(FilterAdapter.java:1346) ~[druid-1.2.11.jar:1.2.11]
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_setString(FilterChainImpl.java:3335) ~[druid-1.2.11.jar:1.2.11]
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.setString(PreparedStatementProxyImpl.java:634) ~[druid-1.2.11.jar:1.2.11]
at com.alibaba.druid.pool.DruidPooledPreparedStatement.setString(DruidPooledPreparedStatement.java:355) ~[druid-1.2.11.jar:1.2.11]
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: dm.jdbc.driver.DMException: Invalid sequence no
看报错是达梦驱动在执行sql设置参数时出现了异常,参数的类型一致无法和数据对应上。
开始我一直以为是#{}中没有加jdbcType导致的,但是加上javaType和jdbcType之后也不能解决问题,我也排查了传入的参数,发现数据并无异常。
于是我开启了mybatis的执行sql打印,在打印的sql中发现了报错所在:
javaType原本是String,而前面竟然多了这些不可识别的特殊字符和空格,这种诡异的问题还是头一次见,我排查了这些数据,本身并没有这些特殊字符,是干干净净的数据,由此推测可能是sql执行传入的参数过多,而导致达梦驱动出现了bug。
达梦执行sql最多传入的参数个数是65535个,超过这个数量执行时会报另一个错误,但是我这里参数没有超过65535,不知为何会出现这个现象。。