The Users Guide describes how to connect to a database using SSL/TSL in general, but the specific details  depend on which database and JDBC driver you use. You should find the details in the documentation of the database and/or JDBC driver, but we have compiled instructions for a few common contexts.

PostgreSQL

MySQL