HikariCP Postgresql Driver Claims to not accept JDBC URL

JavaPostgresqlJdbcCloud FoundryHikaricp

Java Problem Overview


I've pushed my application to cloudfoundry. However every time I connect to my postgresql/elephant sql I received this error

 Driver org.postgresql.Driver claims to not accept JDBC URL jdbc:postgres://cwkqmdql:SsVqwdLxQObgaJAYu68O-8[email protected]:5432/cwkqmdql/

Is there anything I've missed?

Java Solutions


Solution 1 - Java

There are a few issues with that URL and a latest PSQL driver may complain.

  1. jdbc:postgres: should be replaced with jdbc:postgresql:
  2. Do not use jdbc:postgresql://<username>:<passwor>..., user parameters instead: jdbc:postgresql://<host>:<port>/<dbname>?user=<username>&password=<password>
  3. In some cases you have to force SSL connection by adding sslmode=require parameter

So your URL should be:

jdbc:postgresql://@pellefant.db.elephantsql.com:5432/cwkqmdql?user=cwkqmdql&password=SsVqwdLxQObgaJAYu68O-8gTY1VmS9LX

or

jdbc:postgresql://@pellefant.db.elephantsql.com:5432/cwkqmdql?user=cwkqmdql&password=SsVqwdLxQObgaJAYu68O-8gTY1VmS9LX&sslmode=require

I hope that will help.

Solution 2 - Java

In my case it was defining the property in double quotes in the java.properties file

by changing

jdbcUrl="url"

to

jdbcUrl=url

it works again

Solution 3 - Java

The issue I had was that I had given double quotes for the datasource url in the properties file.

What I had given :

spring.datasource.url="jdbc:postgresql://localhost:5432/postgres"

The correct way to give the url is :

spring.datasource.url=jdbc:postgresql://localhost:5432/postgres

Solution 4 - Java

also had this error, but realized it was because i had typed postgressql instead of postgresql in my url

Solution 5 - Java

In my case, two configuration files are in different format:

  1. application.properties in src/main/resources
  2. application.yml in src/test/resources

After changing application.yml to application.properties in src/test/resources, the issue was fixed.

Solution 6 - Java

I had the same issue with h2 DB in WebFlux. The issue was with spring.datasource.driver

Not working

spring.datasource.driver=org.h2.Driver

Working

spring.datasource.driver-class-name=org.h2.Driver

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser962206View Question on Stackoverflow
Solution 1 - JavaTomView Answer on Stackoverflow
Solution 2 - JavaThami BouchnafaView Answer on Stackoverflow
Solution 3 - JavaJyotirmay DashView Answer on Stackoverflow
Solution 4 - Javabreadman0View Answer on Stackoverflow
Solution 5 - JavaTran DuongView Answer on Stackoverflow
Solution 6 - JavaJafar KaruthedathView Answer on Stackoverflow