setEncrypt Method (SQLServerDataSource)
Sets a Boolean value that indicates if the encrypt property is enabled.
public void setEncypt(boolean encrypt)
true if the Secure Sockets Layer (SSL) encryption is enabled between the client and the SQL Server. Otherwise, false.
If the encrypt property is set to true, the Microsoft JDBC Driver for SQL Server ensures that SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed. The default value is false.
The JDBC driver detects the Java Virtual Machine (JVM) it is running on when trying to establish an SSL handshake.
If the encrypt property is set to true, the Microsoft JDBC Driver for SQL Server uses the JVM's default JSSE security provider to negotiate SSL encryption with SQL Server. The default security provider may not support all of the features required to negotiate SSL encryption successfully. For example, the default security provider may not support the size of the RSA public key used in the SQL Server SSL certificate. In this case, the default security provider might raise an error that will cause the JDBC driver to terminate the connection. In order to resolve this issue, do one of the following:
Configure the SQL Server with a server certificate that has a smaller RSA public key
Configure the JVM to use a different JSSE security provider in the "<java-home>/lib/security/java.security" security properties file
Use a different JVM
If the encrypt property is unspecified or set to false, the driver will not enforce the SQL Server to support SSL encryption. If the SQL Server instance is not configured to force the SSL encryption, a connection is established without any encryption. If the SQL Server instance is configured to force the SSL encryption, the Microsoft JDBC Driver for SQL Server will automatically enable SSL encryption when running on properly configured JVM, or else the connection is terminated and the driver will raise an error.