oracle jdbc链接SID和Service Name的区别

application-dev.yml配置文件如下

eureka:
  client:
    serviceUrl:
      defaultZone: http://10.0.100.210:8761/eureka/
server:
  port: 8762
spring:
  application:
    name: service-shedulg-subscribe-book
  datasource:
    test1:
      driverClassName: oracle.jdbc.driver.OracleDriver
      jdbcUrl: jdbc:oracle:thin:@10.0.100.241:1522:crmdbtest
      username: djcrmuat
      password: djcrmuat
    test2:
      driverClassName: oracle.jdbc.driver.OracleDriver
      jdbcUrl: jdbc:oracle:thin:@10.0.100.223:1521:aiiidb
      username: ods
      password: ods
mybatis:
  config-locations: classpath:mybatis/mybatis-config.xml
ribbon:
  ReadTimeout: 60000
  ConnectTimeout: 60000

 运行正常,因为开发环境的oracle数据库配置了Service Name和SID 两种链接方式

但是,生产环境只配置了Service Name链接方式,没有配置SID链接方式,导致上述配置文件执行出错

在不修改数据库,让其SID也可以链接的情况下,修改jdbc链接方式如下

eureka:
  client:
    serviceUrl:
      defaultZone: http://10.0.100.210:8761/eureka/
server:
  port: 8762
spring:
  application:
    name: service-shedulg-subscribe-book
  datasource:
    test1:
      driverClassName: oracle.jdbc.driver.OracleDriver
      jdbcUrl: jdbc:oracle:thin:@10.0.100.34:1521:crmdb
      #jdbcUrl: jdbc:oracle:thin:@//10.0.100.34:1521/crmdb
      username: customer
      password: customer
    test2:
      driverClassName: oracle.jdbc.driver.OracleDriver
      #Service Name链接方式
      #jdbcUrl: jdbc:oracle:thin:@10.0.100.236:1521:odsdb
      #SID链接方式
      jdbcUrl: jdbc:oracle:thin:@//10.0.100.236:1521/odsdb
      username: ods
      password: ods
mybatis:
  config-locations: classpath:mybatis/mybatis-config.xml
ribbon:
  ReadTimeout: 60000
  ConnectTimeout: 60000

 即可正常运行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值