Redirecting clients with the ONEDB_SERVER environment variable

The ONEDB_SERVER environment variable redirection method can be used when an application does not explicitly specify a database server in the CONNECT statement, so that the client connects to the database server that the ONEDB_SERVER environment variable specifies.

If one of the database servers in a cluster is unusable, applications that use that database server can reset their ONEDB_SERVER environment variable to the another database server in the cluster to access the same data.

Applications read the value of the ONEDB_SERVER environment variable only when they start. Therefore, applications must be restarted to recognize a change in the environment variable.

To support this method of redirection, you can use the following connectivity statements:
  • CONNECT TO DEFAULT
  • CONNECT TO database

You cannot use the CONNECT TO database@dbserver or CONNECT TO @dbserver statements for this method. When a database server is explicitly named, the CONNECT statement does not use the ONEDB_SERVER environment variable to find a database server.

Administrators take no action to redirect the clients, but they might be required to change the type of the database server.

Users who are running client applications must perform the following three steps when they decide to redirect clients with the ONEDB_SERVER environment variable.

To redirect clients with the ONEDB_SERVER environment variable:

  1. Quit their applications.
  2. Change their ONEDB_SERVER environment variable to hold the name of the other database server in the replication pair.
  3. Restart their applications.