Configuring TLS/SSL encryption
- Last Updated: January 13, 2025
- 2 minute read
- DataDirect Connectors
- JDBC
- Documentation
The following steps outline how to configure TLS/SSL encryption.
Note: Connection
hangs can occur when the driver is configured for TLS/SSL and the database
server does not support TLS/SSL. You may want to set a login timeout using the
LoginTimeout property to avoid problems when connecting to a server that does
not support TLS/SSL.
To configure SSL encryption:
Important: The driver complies with FIPS when FIPS mode is enabled with the
client JVM. See "FIPS (Federal Information Processing Standard)" for more
information.
- Set general properties required for connection:
- Set the ServerName property to the name or the IP address of the server to which you want to connect. For example, myserver.
- Set the PortNumber property to specify the port number of
the server listener. The default is
5432. - Set properties related to your authentication method. See "Authentication" for details.
- Set the EncryptionMethod property to
SSL.
- (Optional) Set the CryptoProtocolVersion property to specify acceptable cryptographic protocol versions (for example, TLSv1.3) supported by your server.
- (Optional) Specify the location and
password of the truststore file used for SSL server authentication. Either set the
TrustStore and TrustStorePassword properties or their corresponding Java system
properties (
javax.net.ssl.trustStoreandjavax.net.ssl.trustStorePassword, respectively). - (Optional) To validate certificates
sent by the database server, set the ValidateServerCertificate property to
true. - (Optional) Set the HostNameInCertificate property to a host name to be used to validate the certificate. The HostNameInCertificate property provides additional security against man-in-the-middle (MITM) attacks by ensuring that the server the driver is connecting to is the server that was requested.
- (Optional) If your database server is
configured for SSL client authentication, configure your keystore information:
- Specify the location and password of the keystore file.
Either set the KeyStore and KeyStorePassword properties or their
corresponding Java system properties
(
javax.net.ssl.keyStoreandjavax.net.ssl.keyStorePassword, respectively). - If any key entry in the keystore file is password-protected, set the KeyPassword property to the key password.
- Specify the location and password of the keystore file.
Either set the KeyStore and KeyStorePassword properties or their
corresponding Java system properties
(
The following examples demonstrate the required properties for a session using TLS/SSL encryption with user ID and password authentication.
For a connection URL:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:greenplum://myserver:5432;
EncryptionMethod=SSL";User=jsmith;Password=secret;);
For a data source:
GreenplumDataSource mds = new GreenplumDataSource();
mds.setDescription("My Greenplum Data Source");
mds.setEncryptionMethod("SSL");
mds.setServerName("myserver");
mds.setUser("jsmith");
mds.setServerName("secret");
Related Links
- CryptoProtocolVersion
- KeyStore
- KeyStorePassword
- LoginTimeout
- EncryptionMethod
- TrustStore
- TrustStorePassword
- HostNameInCertificate
- ValidateServerCertificate
- KeyPassword
- FIPS (Federal Information Processing Standard)
- Authentication
- Connection property descriptions
- Configuring TLS/SSL Server Authentication
- Configuring TLS/SSL Client Authentication