You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/04/14 13:23:34 UTC

[GitHub] [shardingsphere] ymwangzq opened a new issue #10088: No value specified for parameter xxx

ymwangzq opened a new issue #10088:
URL: https://github.com/apache/shardingsphere/issues/10088


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   4.1.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   sql: 
   ```
   insert ignore into leader_lock (lock_id, owner_id, expire_ts) values (:lockId, :ownerId, UNIX_TIMESTAMP() + :ttlSeconds)
   ```
   
   execute with Spring JdbcTemplate:
   ```
   NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
   jdbcTemplate.update("insert ignore into leader_lock (lock_id, owner_id, expire_ts) values (:lockId, :ownerId, UNIX_TIMESTAMP() + :ttlSeconds)",
                           new MapSqlParameterSource("lockId", lockId)
                                   .addValue("ownerId", ownerId)
                                   .addValue("ttlSeconds", ttlSeconds));
   ```
   expect no exception.
   ### Actual behavior
   exception throws
   ```Caused by: java.sql.SQLException: No value specified for parameter 3
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
   	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861)
   	at com.mysql.jdbc.PreparedStatement.checkAllParametersSet(PreparedStatement.java:2211)
   	at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2191)
   	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2058)
   	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013)
   	at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104)
   	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998)
   	at com.kuaishou.framework.datasource.profiler.connection.ManagedPrepareStatement.executeUpdateWithPerf(ManagedPrepareStatement.java:719)
   	at com.kuaishou.framework.datasource.profiler.connection.ManagedPrepareStatement.executeUpdate(ManagedPrepareStatement.java:255)
   	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
   	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
   	at org.apache.shardingsphere.shardingjdbc.executor.SQLExecuteCallbackFactory$1.executeSQL(SQLExecuteCallbackFactory.java:45)
   	at org.apache.shardingsphere.shardingjdbc.executor.SQLExecuteCallbackFactory$1.executeSQL(SQLExecuteCallbackFactory.java:41)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteCallback.execute0(SQLExecuteCallback.java:82)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteCallback.execute(SQLExecuteCallback.java:58)
   	at org.apache.shardingsphere.underlying.executor.engine.ExecutorEngine.syncExecute(ExecutorEngine.java:97)
   	at org.apache.shardingsphere.underlying.executor.engine.ExecutorEngine.parallelExecute(ExecutorEngine.java:93)
   	at org.apache.shardingsphere.underlying.executor.engine.ExecutorEngine.execute(ExecutorEngine.java:76)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteTemplate.execute(SQLExecuteTemplate.java:68)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteTemplate.execute(SQLExecuteTemplate.java:51)
   	at org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor.executeCallback(AbstractStatementExecutor.java:129)
   	at org.apache.shardingsphere.shardingjdbc.executor.PreparedStatementExecutor.executeUpdate(PreparedStatementExecutor.java:123)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.executeUpdate(ShardingPreparedStatement.java:133)
   	at org.springframework.jdbc.core.JdbcTemplate.lambda$update$0(JdbcTemplate.java:867)
   	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
   	... 20 common frames omitted
   ```
   ### Reason analyze (If you can)
   ```
   org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine#executeRewrite
   ```
   method parameters has 3 items, but return ExecutionUnit.sqlUnit.parameters has only 2 items. Must be something wrong with in this method.
   ```
   org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine#rewrite(org.apache.shardingsphere.underlying.route.context.RouteContext, org.apache.shardingsphere.underlying.rewrite.context.SQLRewriteContext)
   ```
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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.

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



[GitHub] [shardingsphere] strongduanmu closed issue #10088: No value specified for parameter xxx

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #10088:
URL: https://github.com/apache/shardingsphere/issues/10088


   


-- 
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.

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



[GitHub] [shardingsphere] strongduanmu commented on issue #10088: No value specified for parameter xxx

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #10088:
URL: https://github.com/apache/shardingsphere/issues/10088#issuecomment-819943178


   @ymwangzq Duplicate with #7998, and we will fix this problem in next release.
   


-- 
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.

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