这篇文章主要介绍了JDBC连接集群数据库的方法,有需要的朋友可以参考一下 在连接数据库的url地址有点不一样 代码如下: jdbc:oracle:thin:@(DESCRIPTION= (LOAD_BALANCE=on) (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=IP1)(PORT=1521)) (ADDRESS=(PROTO
这篇文章主要介绍了JDBC连接集群数据库的方法,有需要的朋友可以参考一下
在连接数据库的url地址有点不一样
代码如下:
jdbc:oracle:thin:@(DESCRIPTION=
(LOAD_BALANCE=on)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=IP1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=IP2)(PORT=1521))
)
(CONNECT_DATA=(SERVICE_NAME=服务名)))
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)))
本文原创发布php中文网,转载请注明出处,感谢您的尊重!