Active Gridlink : how to configure a JDBC gridlink datasource with RAC (12c)

Active Gridlink datasources are JDBC datasources:

  • that connect to a RAC server
  • that are “aware” of the state of the Oracle RAC server at anytime
  • that respond to FAN events to provide
    • Fast Connection Failover (FCF),
    • Runtime Connection Load-Balancing (RCLB),
    • and RAC instance graceful shutdown

What means that whatever happens to your RAC installation, your programs get always a JDBC working connection even when a RAC node brutally dies or that a node is simply shutdown for maintenance. Better, when the RAC node restart, the JDBC pool get balanced to use the restarted node.

Here is how to configure it:

1. Installation

You need to have :

  • a RAC installation of at least 2 nodes (mine is version 12.1.2.0.2)
  • a JDeveloper or Weblogic installation to configure the JDBC Gridlink  datasource (mine is JDeveloper 12.1.3)
  • a java code sample to check if it works ( GridLinkTest )

If you do not have such install, you follow an blog like this one, to install RAC on VirtualBox.

2. Schema of the installation

3. Check the RAC installation:

First, let’s see if the RAC is working.

  • The database is called “racdb”.
  • It is not a PDB database.
  • It is running on 2 rac nodes racdb_1 and racdb_2
  • The nodes are on machine rac1 and rac2.
  • They are started.

You can also check the database listener:

  • The database service name is racdb

And the ONS service:

The ONS service is started on port 6200 on 192.168.56.21 (rac1) and 192.168.56.22 (rac2).

4. Create the datasource

Go in Weblogic console,

  • for a standalone WLS: something like http://machine:7001/console,
  • or for JDeveloper: http://machine:7101/console

Then in the menu, click Data Sources

0_create_datasource

Click New /  GridLink Data Source

In step 1: “JDBC GridLink Data Source Properties”
  • Name of the connection : jdbc/gridlinkDS
  • JDNI name: jdbc/gridlinkDS
  • Database driver:
    *Oracle’s Driver (Thin) for GridLink Application Continuity Connections; Versions:Any
  • Click Next

1_create_datasource

In step 2: “Transaction Options “
  • Keep the default (one phase commit) and Next
In step 3: “GridLink data source connection Properties Options”
  • Check: Enter complete JDBC URL
  • Click Next
In step 4 : “connection properties”
  • JDBC URL :

Notice:
1) I use the JDBC DESCRIPTION format
2) the HOST NAME is the SCAN hostname. The port and service name are the one we found above (1521 and racdb)

  • username: scott
  • password: tiger
  • Click Next

2_create_datasource

In step 5 “Test GridLink Database Connection”
  • Click “Test All Listeners” (it should work)
  • Click Next
In step 6 “ONS Client Configuration”
  • We will enter the ONS server found above
    ONS host and port:
    192.168.56.21:6200  (Click Add)
    192.168.56.22:6200  (Click Add)
  • Click Next

4_create_datasource

In step 7 “Test ONS client configuration “
  • Click “Test All ONS Nodes” (it should work)
  • Click Next
In step 8 “Select Targets”
  • Select the managed server where you will run the program.
    In my case, it is the DefaultServer of the integrated WLS of JDeveloper

5_create_datasource

  • Click Finish

5. Deploy the test application:

Here is the source of the program and the war file: GridLinkTest

  • Please download it.

You can run it from JDeveloper. Or deploy the WAR file from the WLS console:

  • Go to WLS console : http://machine:7001/console
  • In the domain structure, click deployment
  • Click Install
  • Choose the war file (WLSWeb.war) and deploy it

6. Test

Test 1 – With 2 rac nodes started
  • Go to http://machine:port/WLSWeb/TEST/gridlinkTest.html
  • Set Data Source Location to : jdbc/gridlinkDS
  • Connections to retrieve : 10

6_test_start

  • Click “Test JDBC Gridlink Data Source”

You will see that some of the connections are on rac1 and some on rac2. Ex:

8_test_1_2

Test 2 : stop RAC node 2

Go to the SSH console of your RAC installation.
Stop the node racdb_2.

Go back to http://machine:port/WLSWeb/TEST/gridlinkTest.html

  • Same input than above
  • Click “Test JDBC Gridlink Data Source”
  • You will see only rac1 connections.

8_test_after_stop

If you set up ONS debugging, you will see in the Weblogic log a lot of new log entries like

Test 3 : Restart the node rac2

Go back to http://machine:7001/WLSWeb/TEST/gridlinkTest.html

  • Same input
  • Click Test JDBC Gridlink Data Source
  • You will see rac1 and rac2 connections.

8_test_after_restart

Documentation:

  1. https://docs.oracle.com/middleware/1213/wls/JDBCA/gridlink_datasources.htm
  2. http://www.lab128.com/rac12_installation_using_vb/article_text.html#check_internet_access

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *