According to the error message, the problem is that you are passing empty values ββfor the username and database name. This suggests that your actual code does not match what you entered here. I would write a 10-line Rscript program that simply connects and captures some data, for example:
#!/usr/bin/Rscript library("RPostgreSQL") host = '192.168.36.2' dbname = 'test' port = 5432 password = 'secret' username = 'pep' pg_dsn = paste( 'dbname=', dbname, ' ', 'sslrootcert=', 'rootCA.pem', ' ', 'sslkey=pem.key', ' ', 'sslcert=pem.crt', ' ', 'sslmode=verify-ca', sep="" ) conn <- dbConnect(RPostgreSQL::PostgreSQL(), dbname=pg_dsn, host=host, port=port, password=password, user=username) rs <- dbSendQuery(conn, statement="SELECT COUNT(*) FROM users") data <- fetch(rs, n=1) dim(data)
Therefore, I do not think that this is due to SSL certificates in general, but the fact that your variables are not set the way you think.
EDIT . I created my own certification authority and used it to sign the server certificate and client certificate. I put Postgres 9.3 on a new virtual machine and worked with connections, and certificates are required on both sides. I can connect to psql and R. Therefore, I'm afraid I can not reproduce your problem. But a few things look suspicious in your code:
Does any of these changes fix your problem?
Paul a jungwirth
source share