C Using Connect-Time Failover with Oracle RAC

WebLogic Server provides Connect-Time Failover for legacy applications that use data sources configured to use connect-time failover and load balancing.

Note:

New applications should consider using a GridLink Data Source, which provides the same capabilities. See What is a GridLink Data Source.

Using Connect-Time Failover without Global Transactions

To connect WebLogic Server to multiple Oracle RAC nodes using data sources configured for connect-time failover and load balancing, configure a JDBC data source for each Oracle RAC instance in your Oracle RAC cluster with the Oracle Thin driver, as described in the sections that follow. Figure C-1 shows an overview of the system.

Figure C-1 Data Source Configuration with Oracle Thin Driver Connect-Time Failover

Description of Figure C-1 follows
Description of "Figure C-1 Data Source Configuration with Oracle Thin Driver Connect-Time Failover"

You can use the Administration Console or any other means that you prefer to configure your domain, such as the Weblogic Scripting Tool (WLST) or a JMX program.

When connections are created in the data source, the Oracle Thin driver determines which Oracle RAC instance to use. When an application gets a connection, it looks up a data source on the JNDI tree and requests a connection from the data source. The data source delivers one of the available connections from the pool of connections in the data source.

The following sections describe a configuration which uses Oracle RAC's connect-time failover features to handle connection failures. With this configuration, in some failure cases, the failover time is as long as the TCP timeout, which can be several minutes, depending on your environment.

Attributes of a Connect-Time Failover Configuration without Global Transactions

To use this configuration, create JDBC data sources in your WebLogic domain with the following attributes.

  • Oracle JDBC Thin driver 11g configured for connect-time failover. For example:

    <url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=
        (PROTOCOL=TCP)(HOST=lcqsol24)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)
        (HOST=lcqsol25)(PORT=1521))(FAILOVER=on)(LOAD_BALANCE=off))
        (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=snrac)))</url> 
    <driver-name>oracle.jdbc.OracleDriver</driver-name>
    
  • ConnectionReserveTimeoutSeconds="120"

    • Enables application requests for a connection to wait 120 seconds for a connection to become available.

  • TestConnectionsOnReserve="true"

    • Enables testing of a database connection when an application reserves a connection from the data source. See Test Connections on Reserve to Enable Fail-Over for more details about this attribute.

    • Required to enable failover to another Oracle RAC node.

  • TestTableName="name_of_small_table" The name of the table used to test a physical database connection. For more details about this attribute, see Connection Testing Options for a Data Source.

Sample Configuration Code

Sample configuration code is shown below.

Note:

Line breaks added for readability.
<jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source"
  xmlns:sec="http://xmlns.oracle.com/weblogic/security"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:wls="http://xmlns.oracle.com/weblogic"
  xsi:schemaLocation="http://xmlns.oracle.com/weblogic/domain/1.0/domain.xsd">
  <name>oracleRACNonXAPool</name> 
  <jdbc-driver-params>
    <url>jdbc:oracle:thin:@(DESCRIPTION=
         (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
         HOST=lcqsol24)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)
         (HOST=lcqsol25)(PORT=152))(FAILOVER=on)
         (LOAD_BALANCE=off))(CONNECT_DATA=(SERVER=DEDICATED)
         (SERVICE_NAME=snrac)))</url> 
    <driver-name>oracle.jdbc.OracleDriver</driver-name> 
    <properties>
      <property>
        <name>user</name> 
        <value>wlsqa</value> 
      </property>
    </properties>
    <password-encrypted>{3DES}aP/xScCS8uI=</password-encrypted> 
  </jdbc-driver-params>
  <jdbc-connection-pool-params>
    <test-connections-on-reserve>true</test-connections-on-reserve> 
    <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name> 
    <profile-type>4</profile-type> 
  </jdbc-connection-pool-params>
  <jdbc-data-source-params>
    <jndi-name>oracleRACJndiName</jndi-name> 
    <global-transactions-protocol>OnePhaseCommit
         </global-transactions-protocol> 
  </jdbc-data-source-params>
</jdbc-data-source>