报错堆栈:
org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: java.sql.SQLException: Statement parameter 2 not set.
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: /* ShardingSphere hint: customProperties=Fdeduct_id-122 */ select Fdeduct_id , Fresource_id, Fuin, Fbusi_user_id, Fstatus, Fcount, Famount, Fappid, Fentity, Freclaim_count, Freclaim_amount, Freclaim_status, Freclaim_number, Frelation_deduct_id, Fversion, Fcreate_time, Fmodify_time, Flstate,Fsign,Favailable_status from ap_res_db.t_res_deduct WHERE Flstate = 1 and Fstatus = ? order by Fdeduct_id ASC
Cause: java.sql.SQLException: Statement parameter 2 not set.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectCursor(DefaultSqlSession.java:127)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectCursor(DefaultSqlSession.java:116)
.....(省略内部调用类)
Caused by: java.sql.SQLException: Statement parameter 2 not set.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:85)
at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:633)
at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:417)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:371)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3461)
at com.alibaba.druid.wall.WallFilter.preparedStatement_execute(WallFilter.java:664)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497)
组件信息:
连接池:druid 1.2.9
JDBC 驱动: mysql-connector-java 8.0.28
ORM: MyBatis 3.5.6
database配置
url:jdbc:mysql://ip:port/xxx?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useAffectedRows=true&nullCatalogMeansCurrent=true&zeroDateTimeBehavior=convertToNull&useCursorFetch=true
druid配置:
druid:
# 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时
initial-size: 20
# 最小连接池数量
min-idle: 20
# 最大连接池数量
max-active: 30
# 连接空闲时是否启用保持活动状态 true可以避免频繁的连接建立和关闭操作,提高连接的复用性和性能
keep-alive: true
# 申请连接时检测空闲时间,根据空闲时间再检测连接是否有效.建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRun
test-while-idle: true
# 关闭PSCache:URL 已开启 useCursorFetch=true,会强制使用 MySQL 服务端预编译(ServerPreparedStatement)。
# 在多分片并发游标读场景下,Druid PSCache 与服务端预编译组合会出现 bindValues 数组错位,
# 导致 MySQL 驱动抛出 "Statement parameter N not set" 报错。批跑场景 PSCache 收益极小,故关闭。
pool-prepared-statements: true
# 连接出错后再尝试连接次数
connection-error-retry-attempts: 1
# 是否自动回收超时连接
remove-abandoned: false
# 事务超时时间
transaction-query-timeout: 10
# 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置
max-wait: 500
query-timeout: 2
调用方式:
批跑采用游标的方式进行捞数,部分任务执行出现上面错误。
报错堆栈:
org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: java.sql.SQLException: Statement parameter 2 not set.
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: /* ShardingSphere hint: customProperties=Fdeduct_id-122 */ select Fdeduct_id , Fresource_id, Fuin, Fbusi_user_id, Fstatus, Fcount, Famount, Fappid, Fentity, Freclaim_count, Freclaim_amount, Freclaim_status, Freclaim_number, Frelation_deduct_id, Fversion, Fcreate_time, Fmodify_time, Flstate,Fsign,Favailable_status from ap_res_db.t_res_deduct WHERE Flstate = 1 and Fstatus = ? order by Fdeduct_id ASC
Cause: java.sql.SQLException: Statement parameter 2 not set.
Caused by: java.sql.SQLException: Statement parameter 2 not set.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:85)
at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:633)
at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:417)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:371)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3461)
at com.alibaba.druid.wall.WallFilter.preparedStatement_execute(WallFilter.java:664)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497)
组件信息:
连接池:druid 1.2.9
JDBC 驱动: mysql-connector-java 8.0.28
ORM: MyBatis 3.5.6
database配置
url:jdbc:mysql://ip:port/xxx?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useAffectedRows=true&nullCatalogMeansCurrent=true&zeroDateTimeBehavior=convertToNull&useCursorFetch=true
druid配置:
druid:
# 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时
initial-size: 20
# 最小连接池数量
min-idle: 20
# 最大连接池数量
max-active: 30
# 连接空闲时是否启用保持活动状态 true可以避免频繁的连接建立和关闭操作,提高连接的复用性和性能
keep-alive: true
# 申请连接时检测空闲时间,根据空闲时间再检测连接是否有效.建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRun
test-while-idle: true
# 关闭PSCache:URL 已开启 useCursorFetch=true,会强制使用 MySQL 服务端预编译(ServerPreparedStatement)。
# 在多分片并发游标读场景下,Druid PSCache 与服务端预编译组合会出现 bindValues 数组错位,
# 导致 MySQL 驱动抛出 "Statement parameter N not set" 报错。批跑场景 PSCache 收益极小,故关闭。
pool-prepared-statements: true
# 连接出错后再尝试连接次数
connection-error-retry-attempts: 1
# 是否自动回收超时连接
remove-abandoned: false
# 事务超时时间
transaction-query-timeout: 10
# 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置
max-wait: 500
query-timeout: 2
调用方式:
批跑采用游标的方式进行捞数,部分任务执行出现上面错误。