原文:
RAC (Real Application Cluster)
When dealing with a Real Application Cluster or other complex failover oracle situations, please define the connection like this:
- Set to native (JDBC) connection type
- Leave hostname and port empty (this is also working with a port setting of -1)
- Set the database name to something like this...
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host1-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = host2-vip)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = db-service)(FAILOVER_MODE =(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5))))
or (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=PRIMARY_NODE_HOSTNAME)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=SECONDARY_NODE_HOSTNAME)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DATABASE_SERVICENAME)))
or (DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx)(PORT=1526))(ADDRESS=(PROTOCOL=TCP)(HOST=xxxx)(PORT=1526)))(CONNECT_DATA=(SERVICE_NAME=somesid)))
应该不用翻译了的。注意上面database name的例子是三种配置方式,选一种就好了。
不过这里再记录一个遇到的问题。
就是你的oracle rac版本如果是12c的话,
那你可能要把旧版本的JDBC驱动JAR包换新的OJDBC7.JAR才行,否则回报ORA-28040: No matching authentication protocol。