application-dev.yml配置文件如下
eureka:client:serviceUrl:defaultZone: http://10.0.100.210:8761/eureka/server:port: 8762spring:application:name: service-shedulg-subscribe-bookdatasource:test1:driverClassName: oracle.jdbc.driver.OracleDriverjdbcUrl: jdbc:oracle:thin:@10.0.100.241:1522:crmdbtestusername: djcrmuatpassword: djcrmuattest2:driverClassName: oracle.jdbc.driver.OracleDriverjdbcUrl: jdbc:oracle:thin:@10.0.100.223:1521:aiiidbusername: odspassword: odsmybatis:config-locations: classpath:mybatis/mybatis-config.xmlribbon:ReadTimeout: 60000ConnectTimeout: 60000
运行正常,因为开发环境的oracle数据库配置了Service Name和SID 两种链接方式
但是,生产环境只配置了Service Name链接方式,没有配置SID链接方式,导致上述配置文件执行出错
在不修改数据库,让其SID也可以链接的情况下,修改jdbc链接方式如下
eureka:client:serviceUrl:defaultZone: http://10.0.100.210:8761/eureka/server:port: 8762spring:application:name: service-shedulg-subscribe-bookdatasource:test1:driverClassName: oracle.jdbc.driver.OracleDriverjdbcUrl: jdbc:oracle:thin:@10.0.100.34:1521:crmdb#jdbcUrl: jdbc:oracle:thin:@//10.0.100.34:1521/crmdbusername: customerpassword: customertest2: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/odsdbusername: odspassword: odsmybatis:config-locations: classpath:mybatis/mybatis-config.xmlribbon:ReadTimeout: 60000ConnectTimeout: 60000
即可正常运行