How the DBPATH redirection method works

When an application does not explicitly specify a database server in the CONNECT statement, and the database server that the ONEDB_SERVER environment variable specifies is unavailable, the client uses the DBPATH environment variable to locate the database (and database server).

If one of the database servers in a replication pair is unusable, applications that use that database server are not required to reset their ONEDB_SERVER environment variable if their DBPATH environment variable is set to the other database server in the pair. Their ONEDB_SERVER environment variable must always contain the name of the database server that they use regularly, and their DBPATH environment variable must always contain the name of the alternative database server in the pair.

For example, if applications normally use a database server called cliff_ol, and the database server paired with cliff_ol in a replication pair is called beach_ol, the environment variables for those applications would be as follows:
ONEDB_SERVER  cliff_ol
DBPATH          //beach_ol

Because the DBPATH environment variable is read only (if required) when an application issues a CONNECT statement, applications must restart in order for redirection to occur.

An application can contain code that tests whether a connection has failed and, if so, attempts to reconnect. If an application has this code, you are not required to restart it.

You can use the CONNECT TO database statement with this method of redirection. For this method to work, you cannot use any of the following statements:
  • CONNECT TO DEFAULT
  • CONNECT TO database@dbserver
  • CONNECT TO @dbserver

The reason for this restriction is that an application does not use DBPATH if a CONNECT statement specifies a database server. For more information about DBPATH, see the HCL OneDB™ Guide to SQL: Reference.