欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

JDBC连接集群数据库的方法

程序员文章站 2022-10-13 21:20:03
在连接数据库的url地址有点不一样复制代码 代码如下:jdbc:oracle:thin:@(description=(load_balance=on)(address_li...

在连接数据库的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)))
username=imei_app
password=imei_app