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

   ## Question
   
   Hi, I am using ShardingJdbc 5.1.2 and mybatis-plus.
   I want to create a new datasource dynamically and it could be add to 
ShardingSphereDataSource for management.
   When in ShardingJdbc 4.x it has a way to realize such as below:
   
   ```
   ShardingDataSource shardingDataSource = (ShardingDataSource)dataSource;
   Map<String, DataSource> dataSourceMap = 
shardingDataSource.getDataSourceMap();
   ShardingRule shardingRule = shardingDataSource.getRuntimeContext().getRule();
       
   HikariDataSource newHikariDataSource = new HikariDataSource();
   
newHikariDataSource.setDriverClassName(tenantDataSource.getDriverClassName());
   // ....
   
   dataSourceMap.put(tenantDataSource.getTenantName(),hikariDataSourceNew);
   
shardingRule.getShardingDataSourceNames().getDataSourceNames().add(tenantDataSource.getTenantName());
   ```
   
   But in ShardingJdbc 5.1.2 it seems that I could not add a new datasource for 
ShardingJdbc directly.
   I would appreciate if there is any proposal to me.Thank you. 


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