Home >Database >Mysql Tutorial >JDBC连接集群数据库的方法

JDBC连接集群数据库的方法

WBOY
WBOYOriginal
2016-06-07 14:53:561584browse

这篇文章主要介绍了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)))

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn