Redirecting clients with the connectivity information

You can redirect client connections to the new primary server by using sqlhosts information.

The connectivity information-redirection method relies on the fact that when an application connects to a database server, it uses the connectivity information to find that database server.

If one of the database servers in a replication pair is unusable, an administrator can change the definition of the unavailable database server in the connectivity information. As described in Changing client connectivity information, the fields of the unavailable database server (except for the dbservername field) are changed to point to the remaining database server in the replication pair.

Because the connectivity information is read when a CONNECT statement is issued, applications might be required to restart for redirection to occur. Applications can contain code that tests whether a connection failed and that issues a reconnect statement, if necessary. If a connection failed, redirection is automatic, and you are not required to restart applications for redirection to occur.

Applications can use the following connectivity statements to support this method of redirection:
  • CONNECT TO database@dbserver
  • CONNECT TO @dbserver
Applications can also use the following connectivity statements, provided that the ONEDB_SERVER environment variable always remains set to the same database server name and the DBPATH environment variable is not set:
  • CONNECT TO DEFAULT
  • CONNECT TO database

On UNIX™, the ONEDB_ SQLHOSTS environment variable specifies the full path name and file name of the connection information in $ONEDB_HOME/etc/sqlhosts. For more information about ONEDB_ SQLHOSTS, see the HCL OneDB™ Guide to SQL: Reference.

On Windows™, the connectivity information is in a key in the Windows registry.