I have a database server, where I can log in from my machine using psql:
root@engine:/devops# psql -h database -U postgres -d uat
Given the follow result :
psql (9.5.0, server 9.4.5)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
uat=#
But if I try to connect from my application:
no pg_hba.conf entry for host *** user "postgres", database "uat", SSL off
This is my props.properties used by my application:
uatDb.user=postgres
uatDb.password=***
uatDb.driverClass=org.postgresql.Driver
uatDb.jdbcUrl=jdbc:postgresql://database:5432/uat?ssl=true
uatDb.port=5432
uatDb.name=uat
uatDb.host=database
I even imported the public certificate from my database provider into my application trustore, but doesn't seems to work either.
I wonder why I can connect via psql but my application don't.
Any help ?
psqlbut not my application ?psqlis using SSL, your application is not. Thepg_hbarule also refers to the client's IP address, though you haven't mentioned whether these connections are coming from the same machine.ssl=truein your connection string. Doesn't look like it's taking effect, though I have no idea why...ssl=trueon myurl, it doesn't seems to have any effect tough.