简体   繁体   中英

How to config Oracle RAC in spring boot application.properties

I am using spring boot 1.5.0.release and I want to connect my application to oracle database using oracle RAC (Fast Connection Failover) and the jdbc string like this :

spring.datasource.url:jdbc:oracle:thin:jdbc:oracle:thin:@(DESCRIPTION=(ENABLE=BROKEN)(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip-ent.mncplaymedia.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip-ent.mncplaymedia.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=rac3-vip-ent.mncplaymedia.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=rac4-vip-ent.mncplaymedia.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=rac5-vip-ent.mncplaymedia.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ent)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES = 180)(DELAY = 5))))

spring.datasource.username:xxxx
spring.datasource.password:xxx
spring.datasource.driver-class-name:oracle.jdbc.driver.OracleDriver

and I got error Datasource return null like this :

Caused by: java.sql.SQLTransientConnectionException: DataSource returned null unexpectedly
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:343) ~[HikariCP-2.5.1.jar:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:506) ~[HikariCP-2.5.1.jar:na]
... 71 common frames omitted

any one get this problem before, please help me to resolve this. sorry for my bad english.

您可以通过Spring博客查看UCP吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM