tuichenchuxin commented on issue #12392:
URL: 
https://github.com/apache/shardingsphere/issues/12392#issuecomment-918089133


   @Lychengit You can try like this.
   ```
           // 配置分库策略
           orderTableRuleConfig.setDatabaseShardingStrategy(new 
ComplexShardingStrategyConfiguration("user_id,order_id", 
"dbShardingAlgorithm"));
           // 配置分库算法
           Properties dbShardingAlgorithmrProps = new Properties();
           dbShardingAlgorithmrProps.setProperty("algorithm-expression", 
"ds${(user_id % 2) + (order_id % 3)}");
           
shardingRuleConfig.getShardingAlgorithms().put("dbShardingAlgorithm", new 
ShardingSphereAlgorithmConfiguration("COMPLEX_INLINE", 
dbShardingAlgorithmrProps));```


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