Fusion Middleware Documentation
Advanced Search


Administering JDBC Data Sources for Oracle WebLogic Server
Close Window

Table of Contents

Show All | Collapse

D Using Connect-Time Failover with Oracle RAC (Deprecated)

This chapter provides information on how WebLogic Server provides Connect-Time Failover (deprecated) for legacy applications that use data sources configured to use connect-time failover and load balancing.

Note:

New applications should an Active GridLink data source, which provides the same capabilities. See What is an Active GridLink Data Source and "Implicit Connection Caching" in the Database JDBC Developer's Guide.

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 D-1 shows an overview of the system.

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

Description of Figure D-1 follows
Description of "Figure D-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 that 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 configured for connect-time failover. For example:

    <url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=
        (PROTOCOL=TCP)(HOST=host1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)
        (HOST=host2)(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=host1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)
         (HOST=host2)(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>