Spring Boot属性:Load Balanced数据源

时间:2015-05-14 19:11:33

标签: oracle properties spring-boot datasource

我有以下数据源定义:

spring.datasource.url      = jdbc:oracle:thin:@ (DESCRIPTION = \
(ADDRESS_LIST = \
  (ADDRESS = (PROTOCOL = TCP)(HOST = SOME-DB-SERVER)(PORT = 1521)) \
  (ADDRESS = (PROTOCOL = TCP)(HOST = SOME-DB-OTHER)(PORT = 1521)) \
  (LOAD_BALANCE = yes) \
) \
(CONNECT_DATA = \
  (SERVICE_NAME = My.service) \
) \
)

似乎这不起作用。当第一台服务器没有应答时,第二台服务器不接受其功能并在启动时导致错误。

有没有办法定义这样的数据源?

1 个答案:

答案 0 :(得分:0)

就本文提出的说法: http://docs.oracle.com/cd/B28359_01/java.111/e10788/rac.htm#CHDHCGGG

您似乎在此声明中有错误: LOAD_BALANCE =是

似乎应该是: LOAD_BALANCE = on

低于完整的样本连接字符串:

jdbc:oracle:thin@(DESCRIPTION=
   (LOAD_BALANCE=on)
   (ADDRESS=(PROTOCOL=TCP)(HOST=racnode1) (PORT=1521))
   (ADDRESS=(PROTOCOL=TCP)(HOST=racnode2) (PORT=1521))
   (CONNECT_DATA=(SERVICE_NAME=service_name)))