apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
19.95k stars 6.74k forks source link

In single project, how to realize using sharding-jdbc in sharding scenario, but don't use sharding-jdbc in none sharding scenario. #2378

Closed bigkun closed 5 years ago

wenweibin commented 5 years ago

You can get connection from ShardingDataSource(shardingjdbc) in sharding scenario, but fetch connection from other normal DataSource(dbcp、hikariCP、druid...) in non-sharding scenario

terrymanu commented 5 years ago

You can create more than one different datasource on your application as you want

bigkun commented 5 years ago

We use mybatis in our springboot project. I don't known how to configure it . normal tables use normal mybatis connection; sharding tables , mybatis can work with sharding-jdbc.

terrymanu commented 5 years ago

How to config multiple data source on Mybatis and springboot are Mybatis and springboot's issue. Can you google first? If cannot find way, you can try to search for stackoverflow or talk on springboot or Mybatis's issue