<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-core</artifactId>
<version>${latest.release.version}</version>
</dependency>
Notice: Please change ${latest.release.version}
to the actual version.
Sharding-JDBC can be configured by four methods, Java
, YAML
, Spring namespace
and Spring boot starter
. Developers can choose the suitable method according to different situations. Please refer to Configuration Manual for more details.
Use ShardingDataSourceFactory and rule configuration objects to create ShardingDataSource, which is realized from DataSource, a standard JDBC interface. Then, users can use native JDBC or JPA, MyBatis and other ORM frameworks to develop.
DataSource dataSource = ShardingDataSourceFactory.createDataSource(dataSourceMap, shardingRuleConfig, props);