dbsetlfallback

DB Library for C

DB Library for C

dbsetlfallback

Indicates that dbopen can connect to a failover server if an attempt to connect to a primary server fails.

Syntax

RETCODE DBSETLFALLBACK (     PLOGINREC ploginrec,
    LPCSTR pstatus );

Arguments

ploginrec

Is a pointer to a LOGINREC structure, which is passed as a parameter to dbopen.

pstatus

Specifies whether failover support is enabled or not. Set pstatus to "ON" to enable failover support. Set pstatus to "OFF" to disable failover support.

Returns

SUCCEED or FAIL.

Remarks

This function only works with a standby server configuration; it does not apply to a virtual server cluster/failover configration. Call the DBSETLFALLBACK function to indicate that a failover server can be used by a subsequent call to dbopen. When successfully connected to the primary server, the dbopen function automatically determines the current failover server and verifies that the failover information is stored in the registry. You must call the DBSETLFALLBACK function before you call the dbopen function. If the attempt to connect to the primary server fails, dbopen attempts to connect to the failover server.

Setting pstatus to "ON" or "OFF" determines whether failover support is available during subsequent calls to dbopen.

For DBSETLFALLBACK to function properly, the connection time-out set by calling dbsetlogintime or DBSETLTIME must be a value greater than 0.

Examples

In this example, DBSETLFALLBACK specifies that failover support is enabled prior to a call to dbopen.

DBSETLFALLBACK (loginrec, "ON");
dbproc = dbopen (loginrec, "my_server");