Oracle Weblogic Server : Creating a multi data source

The multi data source should be used when connecting to an Oracle RAC database. The multi data source is a data source abstraction that groups all the individual data sources that connect to each node of the Oracle RAC database.
Consider that the DBApp application requires an XA connection with a JNDI name jdbc/ds-XA added to a database.
The database is an Oracle RAC database with two nodes. The first node has an instance name instance-rac01 and runs in the dbhost-rac01 hostname and listens to the port 1521. The listener accepts requests to the service name dbservice-rac01. The second node is the instance instance-rac02, and it runs in the dbhost-rac02 hostname, listens to the port 1521, and has a service name dbservice-rac02.


Before creating the multi data source, the individual data sources pointing to each RAC node must be created. Two data sources will be created with the names ds-XA-rac01 and ds-XA-rac02 and with the JNDI names jdbc/ds-XA-rac01 and jdbc/ds-XA-rac02.
The multi data source will be named ds-XA and includes both data sources.


Carry out the following steps to create a multi data source:
  1. Access the Administration Console with your web browser at http://adminhost.domain.local:7001/console.
  2. Click on the Lock & Edit button to start a new edit session.
  3. Click on the plus sign to open the Services tree on the left, and then click on Data Sources.
  4. Click on the New button and then click on Generic Data Source.
  5. Type ds-XA-rac01 in the Name field and jdbc/ds-XA-rac01 in the JNDI Name field. Leave the Database Type drop-down menu with the Oracle option selected. Click on the Next button.
  6. Choose *Oracle's Driver (Thin XA) for RAC Service-Instance connections; Versions:10 and later from the Database Driver drop-down menu. Click on the Next button.
  7. Then, click on the Next button in the Transaction Options page.
  8. On the Connection Properties page, type dbservice-rac01 in the Service Name field, instance-rac01 in the Database Name field, dbhost-rac01 in the Host Name field, and 1521 in the Port field. Complete the Database User Name, Password, and Confirm Password fields by typing dbuser, and dbpwd as the username and password respectively. Click on the Next button.
  9. Click on the Next button in the Test Database Connection page.
  10. Select the All servers in the cluster radio button from the PROD_Cluster cluster. Click on the Finish button.
  11. Repeat the previous steps and create another data source. Add ds-XA-rac02 as Name, jdbc/ds-XA-rac02 as JNDI Name, dbservice-rac02 as Service Name, instance-rac02 as Database Name, and dbhost-rac02 in the Host Name field.
    How to do it...
  12. Create the multi data source by clicking on the New button then on the Multi Data Source link.
  13. Type ds-XA in the Name field and jdbc/ds-XA in the JNDI Name field. Leave the other options as their default values. Click on the Next button.
  14. Select the All servers in the cluster radio button from the PROD_Cluster cluster. Click on the Next button.
  15. Select the XA Driver option. Click on Next.
  16. Select both data sources ds-XA-rac01 and ds-XA-rac02 from the left of the Add Data Source page. Click on the >> button in the center of both sides to move them to the right. Click on Finish.
    How to do it...
  17. Finally, click on the Activate Changes button.
The multi data source ds-XA was created with the data sources ds-XA-rac01 and ds-XA-rac02 as members.
The multi data source manages the application requests for a database connection and uses Algorithm Type to define the strategy for high availability.
If using the Failover algorithm, be sure to enable the Failover Request if Busy checkbox of the multi data source.

The multi data source is responsible for managing the load and failover; so if the Oracle database uses the SCAN address feature, it's recommended to set up a GridLink data source instead.