jdbc 连接Oracle RAC

Oracle RAC全称是Oracle real Application Cluster。

RAC是一个软件可以使你通过运行多个依赖相同Database的Instances,使用Cluster硬件,数据库文件被存放在物理或是逻辑上连接每个节点的磁盘上。以便于每个活动的Instance都可以对files进行读写操作。

jdbc连接oracle的连接串如下:

 

1.String url="jdbc:oracle:thin:@(DESCRIPTION =  
2.(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1521))  
3.(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1521))  
4.(LOAD_BALANCE = yes)(FAILOVER = ON)  
5.(CONNECT_DATA =(SERVER = DEDICATED)  
6.(SERVICE_NAME = db.domain)  
7.(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 20)(DELAY = 15))))";  


假设有以下Oracle RAC配置

 

 

2.  Sid = slrac  
3.SLRAC =   
4.  
5.  (DESCRIPTION =   
6.    (ADDRESS_LIST =  
7.      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.231)(PORT = 1521))  
8.      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))  
9.      (LOAD_BALANCE = yes)   
10.    )  
11.  
12.    (CONNECT_DATA =  
13.      (SERVER = DEDICATED)  
14.      (SERVICE_NAME = slrac.beta.com)  
15.      (FAILOVER_MODE =  
16.        (TYPE = SELECT)  
17.        (METHOD = BASIC)  
18.        )   
19.      )  
20.    )  
21.  
22. SLRAC2 =  
23.   (DESCRIPTION =  
24.    (ADDRESS_LIST =  
25.      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))  
26.    )  
27.     (CONNECT_DATA =  
28.      (SERVICE_NAME = slrac.beta.com)   
29.       (INSTANCE_NAME = slrac2)   
30.     )  
31.   )  SLRAC1 =  
32.     (DESCRIPTION =  
33.     (ADDRESS_LIST =  
34.      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.231)(PORT = 1521))   
35.      )  
36.      (CONNECT_DATA =  
37.      (SERVICE_NAME = slrac.beta.com)  
38.      (INSTANCE_NAME = slrac1)  
39.      )  
40.    )


则JDBC URL的配置如下:

 

jdbc:oracle:thin:@(description=(address_list= (address=(host=192.168.1.231) (protocol=tcp)(port=1521))(address=(host=192.168.1.230)(protocol=tcp) (port=1521)) (load_balance=yes)(failover=yes))(connect_data=(service_name= slrac.beta.com)))

 

最后欢迎大家访问我的个人网站:1024s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值