High-Availability Data Replication with connection pooling
- The primary pool contains connections to the primary server in an HDR pair.
- The secondary pool contains connections to the secondary server in an HDR pair.
You do not have to change application code to take advantage of
connection pooling with HDR. Set the IFMX_CPM_ENABLE_SWITCH_HDRPOOL
property to TRUE
to allow switching between the two
pools. When switching is allowed, the Connection Pool Manager validates
and activates the appropriate connection pool.
When the primary server fails, the Connection Pool Manager activates the secondary pool. When the secondary pool is active, the Connection Pool Manager validates the state of the pool to check if the primary server is running. If the primary server is running, the Connection Pool Manager switches new connections to the primary server and sets the active pool to the primary pool.
FALSE
,
you can force switching to the other connection pool by calling the activateHDRPool_Primary() or activateHDRPool_Secondary() methods: public void activateHDRPool_Primary(void) throws SQLException
public void activateHDRPool_Secondary(void) throws SQLException
The activateHDRPool_Primary() method switches the primary connection pool to be the active connection pool. The activateHDRPool_Secondary() method switches the secondary connection pool to be the active pool.
You can use the isReadOnly(), isHDREnabled(), and getHDRtype() methods with connection pooling (see Checks for read-only status of high-availability secondary servers).
A demonstration program is available in the hdr directory within the demo directory where Informix® JDBC Driver is installed. For details about the files, see Sample code files.