Enum SslNegotiation
- All Implemented Interfaces:
Serializable, Comparable<SslNegotiation>
SSL negotiation mode for PostgreSQL connections.
Determines how SSL/TLS is negotiated with the PostgreSQL server.
This setting controls the negotiation protocol, while SslMode
controls whether encryption is required.
- See Also:
-
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SslNegotiationParse the SSL negotiation mode from a string value.static SslNegotiationReturns the enum constant of this type with the specified name.static SslNegotiation[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
POSTGRES
Traditional PostgreSQL SSL negotiation (default).The client sends an SSL request message and waits for the server's response before establishing the SSL connection. This mode works with all PostgreSQL versions.
-
DIRECT
Direct SSL negotiation (PostgreSQL 17+).The client establishes an SSL connection immediately without sending an SSL request message. This mode:
- Reduces connection latency by one round-trip
- Enables standard SSL proxies (nginx, haproxy) to terminate TLS
- Supports SNI/ALPN protocol negotiation
Note: Requires PostgreSQL 17 or later. Attempting to use this mode with earlier PostgreSQL versions will result in an SSL handshake failure.
-
-
Field Details
-
VALUES
-
value
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
of
Parse the SSL negotiation mode from a string value.- Parameters:
value- the string value (case-insensitive)- Returns:
- the corresponding SSL negotiation mode
- Throws:
IllegalArgumentException- if the value is not recognized
-