Set the connection parameters as follows.
Parameter | Explanation |
---|---|
host | Specify the host names, using a comma as the delimiter. |
hostaddr | Specify IP address 1 and IP address 2, using a comma as the delimiter. |
port | Specify the connection destination port numbers, using a comma as the delimiter. The port number can be omitted. If omitted, the default is 26500. If n server names are specified, the (n+1)th and later ports will be ignored. |
target_server | Specify the selection sequence of the servers to which the application will connect. |
sslmode | Specify this to encrypt communications. By default, this is disabled. disable: Connect without SSL allow: Connect without SSL, and if it fails, connect with SSL prefer: Connect with SSL, and if it fails, connect without SSL require: Connect always with SSL verify-ca: Connect with SSL, using a certificate issued by a trusted CA (*1) verify-full: Connect with SSL, using a certificate issued by a trusted CA to verify if the server host name matches the certificate (*1) |
sslservercertcn | This parameter is enabled only to perform SSL authentication (sslmode=verify-full). Specify the server certificate CN. If this is omitted, the value will be null, and the server certificate CN will be authenticated using the host name specified in host. |
*1: If specifying either "verify-ca" or "verify-full", use the system environment variable PGSSLROOTCERT (connection parameter sslrootcert) of your operating system to specify the CA certificate file as shown below.
Example)
Variable name: PGSSLROOTCERT
Variable value: cACertificateFile
Note
If using the connection parameter connect_timeout, this value is applied for connections to each of the specified hosts. If both multiplexed database servers have failed, the connection will time out when a time equal to double the connect_timeout value elapses.
Point
If using the C Library, embedded SQL or psql commands (including other client commands that specify connection destinations), it is recommended to use a connection service file to specify connection destinations.
In the connection service file, a name (service name) is defined as a set, comprising information such as connection destination information and various types of tuning information set for connections. By using the service name defined in the connection service file when connecting to databases, it is no longer necessary to modify applications when the connection information changes.