JDBC连接集群数据库的方法

在三回九转数据库的url地址有一点点不类似复制代码
代码如下:jdbc:oracle:thin:@(DESCMuranoIPTION=(LOAD_BALANCE=on)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=IP1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=IP2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=服务名)))

jdbc 连接oracle rac 一会接连的上一会连接不上的难点?
连续几天代码如下:
[color=blue]Class.forName(“oracle.jdbc.driver.OracleDriver”).newInstance();
String addrRAC = “(ADDRESS=(PROTOCOL=TCP)(HOST =10.0.5.62)(PORT
=1521))(ADDRESS=(PROTOCOL=TCP)(HOST =10.0.5.60)(PORT =1521))”;

url=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL
= TCP)(HOST = 192.168.0.77)(PORT = 1521))(ADDRESS = (PROTOCOL =
TCP)(HOST = 192.168.0.91)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST
= hostIp3)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME =
APPDB)))username=imei_apppassword=imei_app

String url = “jdbc:oracle:thin:@” + “(DESCRIPTION=”

  • “(ADDRESS_LIST=” + addrRAC + “)” + “(CONNECT_DATA=”
  • “(SERVER=DEDICATED)” + “(SERVICE_NAME=racdbs)” + “)”
  • “)”;