Configuring Oracle Real Application Cluster (RAC) with the application server
Oracle Real Application Cluster (RAC) is a "share-everything" database architecture in which two or more Oracle RAC nodes are clustered together and share storage. The RAC nodes are connected together with a high-speed interconnect that enables fast communication between the Oracle nodes. The nodes can exchange various categories of data block ownership information during startup, lock information, exchange transaction information and data, and so on.
About this task
Using the Oracle JDBC driver, you can configure failover support, load balancing, or both, in an Oracle Real Application Clusters (RAC) environment. Oracle RAC is an option of an Oracle database that brings together two or more computers to form a clustered database that behaves as a single system. In a RAC database, Oracle processes that are running in separate nodes access the same data from a shared disk storage. Introduced in Oracle Version 9i, RAC provides both high availability and flexible scalability.
Use the following server.xml to configure Oracle RAC for Liberty:
<dataSource id="ds_id" jndiName="jdbc/ds_id ">
<jdbcDriver>
<library>
<fileset dir="path_to_oracle_jar" includes="ojdbcX.jar"/>
</library>
</jdbcDriver>
<properties.oracle
URL="jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=host1)(PORT=port1))
(ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=port2))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=name)))"
user="username" password="password" />
</dataSource>
FAILOVER
andLOAD_BALANCE
can be configured on or off depending on your installation.host1
andport1
are for the first Oracle RAC node, andhost2
andport2
are for the second Oracle RAC node.- If you are not using Oracle services, then
service_name
is the database name in the example. If you are using Oracle services, thenservice_name
is the name of the services. - The JDBC driver does not have to be nested, as it is in this example, but could also be
specified by using the
jdbcDriverRef dataSource
attribute. - The Oracle login credentials do not need to be specified as Oracle properties, the other methods of database authentication also work.
- Some Oracle RAC functionality requires the use of Oracle Universal Connection Pool (UCP).