Logo
DBPlusEngine-Driver

DBPlusEngine-Driver #

Scenarios #

DBPlusEngine-Driver can be configured by four methods, Java, YAML, Spring namespace and Spring boot starter. Developers can choose the most suitable method according to different situations.

Restrictions #

Currently only Java language is supported.

Prerequisites #

The development environment requires Java JRE 8 or later.

Procedure #

  1. Rules configuration.

Please refer to User Manual for more details.

  1. Import Maven dependency.
<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
    <version>${latest.release.version}</version>
</dependency>

Notice: Please change ${latest.release.version} to the actual version.

  1. Edit application.yml.
spring:
  shardingsphere:
    datasource:
      names: ds_0, ds_1
      ds_0:
        type: com.zaxxer.hikari.HikariDataSource
        driverClassName: com.mysql.cj.jdbc.Driver
        jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
        username: root
        password: 
      ds_1:
        type: com.zaxxer.hikari.HikariDataSource
        driverClassName: com.mysql.cj.jdbc.Driver
        jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
        username: root
        password: 
    rules:
      sharding:
        tables:
            ...