I am build REST api using play framework 2.8 , I am able to start the application and call some service. Facing issue when trying to connecting with postgres database. Logs are below -
Error opening connection for database: {}org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "3.87.112.32", user "abc", database "xyz", SSL off
Tried looking solution for this and foudn have to add sslmode=require in query param while connection to database.
When log the url sslmode is already mentioned.
jdbc:postgresql://abc.amazonaws.com:5432/xyz?password=1234&sslmode=require&user=xyz
I am reading this property from heroku env variable JDBC_DATABASE_URL for obtaining database connection.
This issue can be fixed by adding addition query parameters apart from
sslmode=requirewhich aressl=true&sslfactory=org.postgresql.ssl.NonValidatingFactoryafter adding this the new URL becomejdbc:postgresql://abc.amazonaws.com:5432/xyz?password=1234&sslmode=require&user=xyzssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory