I'm currently trying to connect to a redshift database in R. This needs to be done over an SSL connection but I can't seem to find options to specify the path of the certificate file to use in dbConnect
. Google hasn't been to helpful either surprisingly enough.
我目前正在尝试连接到R中的redshift数据库。这需要通过SSL连接完成,但我似乎无法找到指定要在dbConnect中使用的证书文件的路径的选项。谷歌并没有出人意料地提供帮助。
Is it really that difficult establish a postgres SSL connection to redshift via R or am I just missing out on something fundamental?
是否真的难以通过R建立与红移的postgres SSL连接,或者我只是错过了一些基本的东西?
1 个解决方案
#1
7
simply do:
host = 'redshift-name.xxxxxxxxxxxx.eu-west-1.redshift.amazonaws.com'
dbname = 'your_db_name'
port = 3306
password = 'hunter2'
username = 'rs_user'
redshift_cert = paste0(FILE_PATH, 'redshift-ssl-ca-cert.pem')
pg_dsn = paste0(
'dbname=', dbname, ' ',
'sslrootcert=', redshift_cert, ' ',
'sslmode=verify-full'
)
dbConnect(RPostgreSQL::PostgreSQL(), dbname=pg_dsn, host=host, port=port, password=password, user=username)
#1
7
simply do:
host = 'redshift-name.xxxxxxxxxxxx.eu-west-1.redshift.amazonaws.com'
dbname = 'your_db_name'
port = 3306
password = 'hunter2'
username = 'rs_user'
redshift_cert = paste0(FILE_PATH, 'redshift-ssl-ca-cert.pem')
pg_dsn = paste0(
'dbname=', dbname, ' ',
'sslrootcert=', redshift_cert, ' ',
'sslmode=verify-full'
)
dbConnect(RPostgreSQL::PostgreSQL(), dbname=pg_dsn, host=host, port=port, password=password, user=username)