Automatic redirection with server groups

You can use the group option in the sqlhosts file to specify a server group to which applications connect instead of an individual database server. To make connection redirection automatic, add a database server definition for both the primary and secondary servers to the server group definition. By default, when a connection request is made to an HDR server group, the connection is routed to the primary server. If the primary server is unavailable, then the connection request is routed to the secondary server that gets promoted to the primary server after failover processing.

For example, the following sqlhosts entries represent an HDR server group, g_hdr, with a primary server definition, hdr_prim, and a secondary server definition, hdr_sec.
#dbservername   nettype    hostname      servicename   options
g_hdr           group      -             -             i=1
hdr_prim        ontlitcp   machine1pri   port1         g=g_hdr
hdr_sec         ontlitcp   machine1sec   port1         g=g_hdr
Applications can use the following connectivity statements to support this method of redirection:
  • CONNECT TO database@dbserver_group
  • CONNECT TO @dbserver_group

If your applications contain code that tests if a connection has failed and issues a reconnect statement if necessary, redirection is handled automatically. The user has no responsibilities. If your applications do not include such code, users who are running clients must quit and restart all applications.


Copyright© 2019 HCL Technologies Limited