本篇文章只适用于已知表数量的,不适合动态创建表。
1、配置文件
spring:datasource:type: com.alibaba.druid.pool.DruidDataSourceusername: rootpassword: rootdriver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/db?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8druid:# 初始连接数initialSize: 5# 最小连接池数量minIdle: 5# 最大连接池数量maxActive: 20# 配置获取连接等待超时的时间maxWait: 60000shardingsphere:datasource:names: db0db0:data-source-name: com.alibaba.druid.pool.DruidDataSourcetype: com.alibaba.druid.pool.DruidDataSourcedriver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8username: rootpa