Luckyangle opened a new issue, #19741:
URL: https://github.com/apache/shardingsphere/issues/19741

   ## Bug Report
   
   Environment: springboot + mysql + mybatis-plus
   Question: can't read data from read datasource, please help me out, thank 
you.
   
   ```
     shardingsphere:
       datasource:
         write-ds-0:
           driver-class-name: com.mysql.cj.jdbc.Driver
           type: com.zaxxer.hikari.HikariDataSource
           username: root
           password: root
           jdbc-url: 
jdbc:mysql://127.0.0.1:3306/write-ds-0?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
         write-ds-0-read-0:
           driver-class-name: com.mysql.cj.jdbc.Driver
           type: com.zaxxer.hikari.HikariDataSource
           username: root
           password: root
           jdbc-url: 
jdbc:mysql://127.0.0.1:3306/write-ds-0-read-0?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
         write-ds-0-read-1:
           driver-class-name: com.mysql.cj.jdbc.Driver
           type: com.zaxxer.hikari.HikariDataSource
           username: root
           password: root
           jdbc-url: 
jdbc:mysql://127.0.0.1:3306/write-ds-0-read-1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
         names: write-ds-0,write-ds-0-read-0,write-ds-0-read-1
       props:
         sql-show: true
       rules:
         dataSources:
           readwrite_ds_0:
             staticStrategy:
               writeDataSourceName: write-ds-0
               readDataSourceNames: write-ds-0-read-0,write-ds-0-read-1
             loadBalancerName: round_robin
           loadBalancers:
             round_robin:
               type: ROUND_ROBIN
   ```
   
   SQL log:
   ```
   2022-08-01 14:38:20.604  INFO 30024 --- [           main] ShardingSphere-SQL 
                      : Logic SQL: SELECT  order_id,price,user_id,create_time  
FROM t_order
   2022-08-01 14:38:20.604  INFO 30024 --- [           main] ShardingSphere-SQL 
                      : SQLStatement: 
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, 
lock=Optional.empty, window=Optional.empty)
   2022-08-01 14:38:20.604  INFO 30024 --- [           main] ShardingSphere-SQL 
                      : Actual SQL: write-ds-0 ::: SELECT  
order_id,price,user_id,create_time  FROM t_order
   
   ```
   
   ### Which version of ShardingSphere did you use?
   5.1.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   write data to write datasource, read data from read datasource
   
   ### Actual behavior
   always read from write datasource
   
   ### Reason analyze (If you can)
   I can't fix it.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1. Download the code.
   2. Create database follow the YML configuration file.
   3. Execute sql file to create all tables.
   4. Run Tests.
   ### Example codes for reproduce this issue (such as a github link).
   github repository link: https://github.com/Luckyangle/shardingshpere-demo


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to