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/