Sharding-JDBC is a distributed database middleware, focus on data sharding, read-write splitting, BASE transaction and database orchestration. It provides maximum compatibilities for applications by JDBC driver or database protocols proxy.
- Both databases and tables sharding supported.
- Standard aggregation functions, GROUP BY, ORDER BY, LIMIT and JOIN DQL supported.
- Standard DML, DDL, TCL and database administrator command supported.
- Sharding operator
=,BETWEENandINsupported. - Sharding algorithm customization and inline expression supported.
- Route by hint supported.
- Distributed sequence supported.
- Multiple slaves replica supported.
- Data consistency guarantee in same thread supported.
- Mix read-write splitting and data sharding supported.
- Route by hint supported.
- Best efforts delivery transaction supported.
- Try confirm cancel transaction (TBD).
- Configuration center supported, can refresh dynamically.
- Circuit breaker supported.
- Open tracing supported.
Use JDBC connect databases without redirect cost for java application, best performance for production.
- ORM compatible. JPA, Hibernate, Mybatis, Spring JDBC Template or JDBC supported.
- Connection-pool compatible. DBCP, BoneCP, Druid supported.
- Multi SQL-based databases compatible. Any Database supported theoretically. Support MySQL, Oracle, SQLServer and PostgreSQL right now.
Database router. Deploy as a stateless server, support MySQL protocol for now.
- Use standard MySQL protocol, application do not care about whether proxy or real MySQL.
- Any MySQL command line and UI workbench supported in theoretically. MySQL Workbench are fully compatible right now.
Use sidecar to connect databases, best for Kubernetes or Mesos together.
<!-- import sharding-jdbc core -->
<dependency>
<groupId>io.shardingjdbc</groupId>
<artifactId>sharding-jdbc-core</artifactId>
<version>${latest.release.version}</version>
</dependency>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.
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);Edit ${sharding-proxy}\conf\sharding-config.yaml. Same format with Sharding-JDBC-Driver's YAML configuration.
${sharding-proxy}\bin\start.sh ${port}


