JDBC 如何配置RAC 的Load Balance ?

How to Implement Load Balancing With RAC Configured System Using JDBC

Doc ID: 247135.1

 

PURPOSE
-------

This document discusses how to implement load balancing from a JDBC application
that connects to a RAC configured system.


SCOPE & APPLICATION
-------------------

This material is intended for developers or analysts.


How to Implement Load Balancing With RAC Configured System Using JDBC
---------------------------------------------------------------------
Here are the steps to follow in configuring load balancing and connecting
with a JDBC program:

1.  Verify that from the same system that you are running your JDBC program that
load balancing is working from sqlplus.

If you do not have sqlplus on the same system that you will be running your
JDBC program from, download the "Instant Client" that contains sqlplus from :

http://www.oracle.com/technology/software/index.html

Here are some notes that will help you get the setup working:

Note 226880.1 Configuration of Load Balancing and Transparent Application Failover
Note 263599.1 Understanding and Troubleshooting Instance Load Balancing
Note 69010.1 Client Load Balancing and Failover Using Description and Address_List

The following note provides a script. for automating the testing of load
balancing from sqlplus (just ignore the oc4j references):

Note 388448.1 How to setup Fast Connection Failover within OAS 10.1.3 oc4j instances

Use your connect string if you use this script.

2. Now modify the connection string (host:port:sid) in your JDBC program
with the full name-value pair syntax as used in step (1) ...


url="jdbc:oracle:thin:@(DESCRIPTION=
     (LOAD_BALANCE=on)
        (ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
        (ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521))
        (CONNECT_DATA=(SERVICE_NAME=service_name)))"
or

url="jdbc:oracle:thin:@(DESCRIPTION=
        (ADDRESS=(PROTOCOL=TCP)(HOST=cluster_alias) (PORT=1521))
        (CONNECT_DATA=(SERVICE_NAME=service_name)))"


conn = DriverManager.getConnection(url, user_name, password);

You can use the TestFailover program in the following note:

Note 213412.1 How to Implement Connect Failover Using JDBC Thin

with your connect string as a starting example.

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-600650/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/35489/viewspace-600650/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值