Connection retry allows the PostgreSQL driver to retry connections to the primary database server, and if specified, alternate servers until a successful connection is established. You use the ConnectionRetryCount and ConnectionRetryDelay properties to enable and control how connection retry works. For example:


jdbc:datadirect:postgresql://server1:5432;DatabaseName=TEST;User=test;
Password=secret;AlternateServers=(server2:5432;DatabaseName=TEST2,
server3:5432;DatabaseName=TEST3);ConnectionRetryCount=2;
ConnectionRetryDelay=5
Note: The User and Password properties are not required to be stored in the connection string. They can also be passed separately by the application.

In this example, if a successful connection is not established on the PostgreSQL driver’s first pass through the list of database servers (primary and alternate), the driver retries the list of servers in the same sequence twice (ConnectionRetryCount=2). Because the connection retry delay has been set to five seconds (ConnectionRetryDelay=5), the driver waits five seconds between retry passes.