How to compile RpostgreSQL using libssl and libpg and SSL activation

I use R on Windows to connect to a PostgreSQL database hosted on AWS. The database is configured using forcessl = 1 - this means that any connection must be configured using sslmode = require.

The base package RPostgreSQLdoes not provide any ssl options. This has repeatedly been raised as a problem (see here , here , here and here )

I know that there is a workaround using the package RPostgres, but for other reasons of functionality, I would prefer to use the package RPostgreSQL.

Several answers (e.g. here ) suggested using the modified dbname to connect to ssl as follows:

dbConnect(dbDriver('PostgreSQL'),
    dbname   = 'dbname=foobar sslmode=require', # modified dbname
    host     = 'foobar.rds.amazonaws.com',
    port     = 5439,
    user     = 'foobar',
    password = 'foobar')

But this did not work for me using the CRAN version of the package. This led me to a recent issue raised in github RPostgreSQL: https://github.com/tomoakin/RPostgreSQL/issues/88

The original user was able to use the modified dbname method when he compiled the package from the source. On Windows, using the latest source package (0.6.2) compiled with RTools, I get the following error when I run the modified dbname code:

Error in postgresqlNewConnection(drv, ...) : 
  RS-DBI driver: (could not connect xxxxx.rds.amazonawss.com:5432 on dbname "xxxxxxx": sslmode value "require" invalid when SSL support is not compiled in
)

From this and the rest of the stream, it seems that SSL is not possible from the current source on both Windows and Mac. However, the developer offers:

, libssl libpq SSL, SSL.

, , , , , . . , ?

+6
2

Windows - . . R-Admin Windows Toolset. openSSL - . openSSL - , . , openSSL R R, .

EDIT. , postgres Windows postgres openSSL. , Windows - Windows R, postgres, R libpq.

Linux . : Linux Windows. linux, , - linux ( RedHat Linux):

sudo yum install openSSL
sudo yum install postgresql96
sudo yum install R

2 libpq, RPostgreSQL. libpq, openSSL. PostgreSQL, , psql. , . R linux toolset. , .

RPostgreSQL libpq, script openSSL, , macOS. libpq.

configure script RPostgreSQL pg_config, postgres. . , pg_config . pg_config, .

RPostgreSQL. R, linux.

R

R , RPostgreSQL:

install.packages("https://cran.r-project.org/src/contrib/RPostgreSQL_0.6-2.tar.gz", repo=NULL, type="source")

RPostgreSQL. Windows, Windows.

, .

+1

El Capitan macOS R , :

  • RPostgreSQL R, . , , R.app R remove.packages('RPostgreSQL')

  • , Homebrew : brew install libpq openssl

  • R.app Packages & Data Package Installer.

  • CRAN (sources) ( , ).

  • , RPostgreSQL , At System Level Install Dependencies, Install Selected.

  • R RStudio RPostgreSQL.

: OpenSSL libpq , , .

0

All Articles