Can't create dbConnect to Postgres with SSL

99封情书 提交于 2019-12-19 09:04:26

问题


I'm running a Postgres-9.4 server that I would like to require SSL for. When I connect to the Postgres server from my laptop with either pgadmin or windows odbc connection, it works with SSL. However when I try to connect with R using SSL it fails.

library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, 
                 user = "postgres", 
                 password = mypasswd, 
                 dbname = "dbname=postgres sslmode=prefer",
                 host = "192.168.1.179")

If I set my pg_hba.conf to allow non-ssl connections then this will work. When I set it to only allow SSL connections then this will fail. Unfortunately dbConnect doesn't have a verbose option so I don't get anything more than could not connect postgres@192.168.1.179 on dbname "postgres"

I found this question which seems to suggest I'm doing the right thing but, no go.

Edit:

I did some more digging and found this discussion which suggests that this won't work on windows due to various library/dll issues. That discussion is a few years old at this point so perhaps it has been resolved. I can confirm that doing the above from linux does work.

来源:https://stackoverflow.com/questions/34244210/cant-create-dbconnect-to-postgres-with-ssl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!