Skip to content

Provide SSL certificate to SQL Server via JDBC

The Microsoft JDBC SSL documentation details the use of a Java keystore in order to specify a certificate bundle to use when validating the TLS connection. Is there a way to provide a certificate bundle without needing to store it within a JKS when connecting to a SQL Server database? Postgres seems to have a sslrootcert option which appears to be lacking for SQL Server.



Since version 6.3.3 the Microsoft JDBC Driver for SQL allows, to specify a custom implementation of through connection properties. You can specify a class name and a constructor parameter (e.g. a file name or the certificate in PEM format).

See here, for more detailed instructions and a simple example of a custom TrustManager. The functionality of the sslrootcert option of the Postgres driver is implemented in a similar way here.

2 People found this is helpful