Skip to content

jjunqueira/jjunqueira.github.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Joshua Junqueira's Code Blog

October 6 2017 - Setup Postgres JDBC with SSL

I had never setup postgres + jdbc + ssl before so I thought I would give it a shot today. The newer versions of postgres 9.6+ seem to have ssl configured out of the box. I did not find an easy answer in my googling of "How to setup postgres jdbc with ssl" so I thought I would quickly write it up.

Basically all you have to do is modify your connection string to look like this: postgres://user:password@host/dbname?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

Obviously you will want to setup properly signed certs in production so you will not need to use the NonValidatingFactory, but for testing this works just fine.

NOTE: I am using slick for all my database interactions and it accepts the url above for postgres connections if you are using another library it is possible the format may be different.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published