<dependency>
<groupId>io.shardingsphere</groupId>
<artifactId>sharding-jdbc-core</artifactId>
<version>${latest.release.version}</version>
</dependency>
Note: Please change the ${latest.release.version}
to the actual version.
Sharding-JDBC support 4 types for sharding rule configuration, they are Java
, YAML
, Spring namespace
and Spring boot starter
. Developers can choose any one for best suitable situation. More details please reference Configuration Manual.
Use ShardingDataSourceFactory to create ShardingDataSource, which is a standard JDBC DataSource. Then developers can use it for raw JDBC, JPA, MyBatis or Other JDBC based ORM frameworks.
DataSource dataSource = ShardingDataSourceFactory.createDataSource(dataSourceMap, shardingRuleConfig);