Reputation: 135
I'm trying to use the Heroku postgresql add-on in my spring boot application (locally first). In my application properties, I removed the local server information and updated it with the Heroku credentials. I also added the posgresql dependency in my gradle file.
My code:
spring.datasource.url=jdbc:postgres://qfxqpoceljdtfo:f50b14498b7be95f0a1f4cf466b09b54ed8bbefaac9aa28a97b14719d0625e56@ec2-23-21-201-255.compute-1.amazonaws.com:5432/d6eqamh4egp1g0
spring.datasource.username=qfxqpoceljdtfo
spring.datasource.password=***Password***
spring.datasource.driver-class-name=org.postgresql.Driver
Heroku Credentials:
Host: ec2-23-21-201-255.compute-1.amazonaws.com
Database: d6eqamh4egp1g0
User: qfxqpoceljdtfo
Port: 5432
Password: ***Password***
URI postgres://qfxqpoceljdtfo:f50b14498b7be95f0a1f4cf466b09b54ed8bbefaac9aa28a97b14719d0625e56@ec2-23-21-201-255.compute-1.amazonaws.com:5432/d6eqamh4egp1g0
Heroku CLI: heroku pg:psql postgresql-metric-82455 --app battlesh1p
The resulting error is:
java.sql.SQLException: Driver:org.postgresql.Driver@20999517 returned null for URL
I've also tried using:
jdbc:postgresql://ec2-23-21-201-255.compute-1.amazonaws.com:5432/d6eqamh4egp1g0?sslmode=require
Which results in this error
org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "94.248.76.191", user "qfxqpoceljdtfo", database "d6eqamh4egp1g0", SSL off
Upvotes: 1
Views: 286
Reputation: 135
In case anyone comes across this. The Heroku documentation worked fine in configuring my application to use the postgres database plug-in in production. But I could never get my spring app to run locally and access the host DB.
Upvotes: 1