“HostName not verified error message” on SSL conne

2020-06-09 04:23发布

I created server.crt, server.key and root.crt files on Centos 7 and put the same onto the C:\Users\xxxx\AppData\Roaming\postgresql folder in windows as i am running the postgresql server on windows. Now on running my applications using SSL, i am getting the error as

"The host name could not be verified"

Any help please.

3条回答
冷血范
2楼-- · 2020-06-09 04:53

To use the PostgreSQL JDBC driver without server certificate validation, use

sslfactory=org.postgresql.ssl.NonValidatingFactory

as connection parameter or as part of the URL as described in the documentation.

With later versions of the JDBC driver, you have to specify

sslmode=require

because the default value verify-full means that the client wants to check the certificate and identity of the server.

查看更多
狗以群分
3楼-- · 2020-06-09 04:55

I am using JetBrains Data Grip to access Postgres dbs on Heroku, and got the same error in the latest JDBC driver version. That's how I solved it (using answers provided here).

Set the following in the Advanced tab:

ssl=true

sslmode=required

sslfactory=org.postgresql.ssl.NonValidatingFactory

JetBrains Data Grip connection settings for Heroku Postgres dbs

(I updated sslmode value from verify-ca to required because it works with Heroku Postgres now)

查看更多
看我几分像从前
4楼-- · 2020-06-09 05:10

If you don't care about hostname verification while still wanting to use a certificate, you can use the additional parameter sslmode=verify-ca as a connection parameter or as part of the URL to disable hostname verification while retaining certificate verification.

查看更多
登录 后发表回答