问题
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-8gTY1VmS9LX@pellefant.db.elephantsql.com:5432/cwkqmdql/
Is there anything I've missed?
回答1:
There are a few issues with that URL and a latest PSQL driver may complain.
jdbc:postgres:
should be replaced withjdbc:postgresql:
- Do not use
jdbc:postgresql://<username>:<passwor>...
, user parameters instead:jdbc:postgresql://<host>:<port>/<dbname>?user=<username>&password=<password>
- 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.
回答2:
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
来源:https://stackoverflow.com/questions/34741443/hikaricp-postgresql-driver-claims-to-not-accept-jdbc-url