Chapter 4. Using SSL

Table of Contents

Configuring the Server
Configuring the Client
Using SSL without Certificate Validation
Custom SSLSocketFactory

Configuring the Server

Configuring the PostgreSQL™ server for SSL is covered in the main documentation, so it will not be repeated here. Before trying to access your SSL enabled server from Java, make sure you can get to it via psql. You should see output like the following if you have established a SSL connnection.

$ ./bin/psql -h localhost
Welcome to psql 8.0.0rc5, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)