ShardingSphere JDBC 不支持不同类型的源测试

ShardingSphere JDBC 不支持不同类型的源测试

废话少说。
ShardingSphere JDBC官方配置文档
https://shardingsphere.apache.org/document/legacy/4.x/document/cn/manual/sharding-jdbc/configuration/config-java/

环境说明

<spring.boot.version>2.1.13.RELEASE</spring.boot.version>
<shardingsphere.version>4.1.1</shardingsphere.version>
<mybatis.spring.boot.starter.version>2.1.1</mybatis.spring.boot.starter.version>
<druid.spring.boot.starter.version>1.1.22</druid.spring.boot.starter.version>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.13.RELEASE</version>
</parent>

<dependency>
    <groupId>org.apache.shardingsphere</groupId>
    <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
    <version>${shardingsphere.version}</version>
</dependency>

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>${mybatis.spring.boot.starter.version}</version>
</dependency>

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid</artifactId>
    <version>${druid.spring.boot.starter.version}</version>
</dependency>

配置说明

shardingsphere:
  datasource:
    names: customer-master,customer-slave,dhep-master
    customer-master:
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:3306/creditcloud_customer?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
      username: user_cloud_cus
      password: ENC(MqKzNeoGyIlqDkOaEFTz10b/98ZYdcu1)
      type: com.alibaba.druid.pool.DruidDataSource
      initial-size: 10
      min-idle: 10
      max-active: 30
      test-on-borrow: true
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
    customer-slave:
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:3308/creditcloud_customer?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
      username: user_cloud_cus
      password: ENC(MqKzNeoGyIlqDkOaEFTz10b/98ZYdcu1)
      type: com.alibaba.druid.pool.DruidDataSource
      initial-size: 10
      min-idle: 10
      max-active: 30
      test-on-borrow: true
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
    dhep-master:
      driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
      url: jdbc:sqlserver://127.0.0.1:1443;database=DHEP
      username: dhep_sa
      password: ENC(/8Jt1gBaz2aT2TP6ru0/CW5md2V/yDVR)
  masterslave:
    load-balance-algorithm-type: round_robin
    master-data-source-name: customer-master
    slave-data-source-names: customer-slave
    name: ds_ms
  sharding:
    master-slave-rules:
      ds_db01:
        masterDataSourceName: customer-master
        slaveDataSourceNames:
          - customer-slave
      ds_db02:
        masterDataSourceName: dhep-master
        slaveDataSourceNames: none
    default-data-source-name: ds_db01
    default-database-strategy:
      hint:
        algorithm-class-name: com.dahuatech.creditcloud.customer.core.sharding.DatasourceRoutingAlgorithm
    props:
      sql.show: false

结论:

org.apache.shardingsphere.shardingjdbc.jdbc.adapter.AbstractDataSourceAdapter.java

img

ardingjdbc.jdbc.adapter.AbstractDataSourceAdapter.java


[外链图片转存中...(img-wPwvoOSL-1602920450925)]

此处是不同数据源的校验。不支持不同类型的数据源共用。
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值