RE: RAC failover and JDBC string

  • From: "Bobak, Mark" <Mark.Bobak@xxxxxxxxxxxx>
  • To: "JDunn@xxxxxxxxx" <JDunn@xxxxxxxxx>, oracle-l <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 14 Aug 2008 10:16:10 -0400

Hi John,

I assume you're talking JDBC thin client, since w/ thick, you just use a 
load-balancing/failover connect string.

I also assume you're using a JDBC thin URL that looks something like this:
jdbc:oracle:thin:@rac01:1521/pqprd

So, the above will connect to rac01 node every time, and will not help w/ load 
balancing and failover.  If rac01 crashes, my app is dead in the water.

However, you can do something like this w/ JDBC:
Jdbc:oracle:thin@ (DESCRIPTION =(LOAD_BALANCE=on)(FAILOVER=on) (ADDRESS_LIST = 
(ADDRESS = (PROTOCOL = TCP)(HOST = rac01-vip)(PORT = 1521)) (ADDRESS = 
(PROTOCOL = TCP)(HOST = rac02-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = 
TCP)(HOST = rac03-vip)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = 
pqprd)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))))

In other words, you can embed the entire load balancing, failover enabled 
connect string into your JDBC thin url.

Hope that helps,

-Mark

--
Mark J. Bobak
Senior Database Administrator, System & Product Technologies
ProQuest
789 E. Eisenhower, Parkway, P.O. Box 1346
Ann Arbor MI 48106-1346
+1.734.997.4059  or +1.800.521.0600 x 4059
mark.bobak@xxxxxxxxxxxx<mailto:mark.bobak@xxxxxxxxxxxxxxx>
www.proquest.com<http://www.proquest.com>
www.csa.com<http://www.csa.com>

ProQuest...Start here.

From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of John Dunn
Sent: Thursday, August 14, 2008 5:32 AM
To: oracle-l
Subject: RAC failover and JDBC string

I need to understand how RAC handles hostnames in JDBC connection strings.

If I have an application that uses a JDBC connection string(that contains a 
hostname) to connect to the Oracle database, what happens if there is a 
failover to another server in the RAC cluster?





Other related posts: