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
即可正常运行