1

I know this question appeared on stackoverflow, but none of the solutions worked for me. I have a Spring Boot application that is auto-configured. I have this application.properties :

#HEROKU CREDENTIALS
spring.datasource.url=jdbc:postgres://my_url/database?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

spring.datasource.username=username
spring.datasource.password=my_password
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.show-sql=true

When application is deployed on Heroku everything works perfectly. When I try to run it on my local machine I can't connect to the database.

java.sql.SQLException: Driver:org.postgresql.Driver@69ec93c2 returned null for URL: my_url
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:329) ~[tomcat-jdbc-8.5.14.jar:na]
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203) ~[tomcat-jdbc-8.5.14.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:735) [tomcat-jdbc-8.5.14.jar:na]
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:667) [tomcat-jdbc-8.5.14.jar:na]

As you can see in the application.properties I added the ssl and sslfactory but no success.

2
  • 1
    I think jdbc:postgres:// should be jdbc:postgresql://, but that doesn't seem to be the main problem. Commented Jul 14, 2017 at 8:33
  • @codefinger, It actually worked !!! Thank you very much Commented Jul 14, 2017 at 8:49

2 Answers 2

1

The URL prefix jdbc:postgres:// should be jdbc:postgresql://

Sign up to request clarification or add additional context in comments.

Comments

0

Looks like it could be related to an underscore in the hostname. Looks like underscores are allowed in hostnames : See https://stackoverflow.com/a/7852692/227986

1 Comment

No underscores. If there were underscores I suppose it wouldn't work at all : jdbc:postgres://ec2-174-129-224-33.compute-1.amazonaws.com:5432/d84d5t07vqtcfj

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.