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 2019/11/15 09:10:05 UTC

[GitHub] [incubator-shardingsphere-example] ctjy opened a new issue #195: HintManager.setDatabaseShardingValue() 使用PreparedStatement 不生效, Statement则生效

ctjy opened a new issue #195: HintManager.setDatabaseShardingValue() 使用PreparedStatement 不生效, Statement则生效
URL: https://github.com/apache/incubator-shardingsphere-example/issues/195
 
 
   ## Question
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.
   - Searched open and closed [GitHub issues](https://github.com/apache/incubator-shardingsphere-example/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 **more than 7 days** and we cannot reproduce it on current information, we will **close it**.
   
   private static void processWithHintValue(final DataSource dataSource) throws SQLException {
          
       	String sql = "SELECT * from t_order ";
       	try (HintManager hintManager = HintManager.getInstance();
                Connection connection = dataSource.getConnection();
                PreparedStatement statement = connection.prepareStatement(sql)) {
               setHintValue(hintManager);
               statement.execute();
               //statement.execute("SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id");
              // statement.execute("select * from t_order_item");
              // statement.execute("INSERT INTO t_order (user_id, address_id, status) VALUES (1, 1, 'init')");
           }
       }
   
   [INFO ] 2019-11-15 17:08:56,599 --main-- [ShardingSphere-SQL] Actual SQL: ds_0 ::: SELECT * from t_order  
   [INFO ] 2019-11-15 17:08:56,599 --main-- [ShardingSphere-SQL] Actual SQL: ds_1 ::: SELECT * from t_order 
   
   

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


With regards,
Apache Git Services