connect to postgre db through ssh tunnel by r

Hello everyone I am trying to connect to postgredb through ssh ın R , ı found somethıng to do this but ı don't understand the parameters can anybody help about the subject,thank u for your interest already have a nice day Merve

Can you show what you've done so far? It'll be easier to guide you once we get the picture of where you are in your path.

In general, RPostgres package should be quite straight-forward to use.

Continuing the discussion from connect to postgre db through ssh tunnel by r:

Hello yes I use RPostgres package for the database connectin but the problem is about making an ssh tunnel,ı found something like that

ssh -p Port -L LocalPort:IP:RemotePort servername"

but I couldn't understand the parameters,

and on the other hand ı can already connect to the database by a vpn ssh tunnel outside of R.But I need to connect it by r.

I run the below codes but of course it didn't work

[‎10/‎1/‎2019 9:15 PM]

myssh<-"ssh -f merve_sarac@ip -L port:localhost:22 -N"


Connect to DB

drv <- dbDriver("PostgreSQL")

conn <- dbConnect(


host = "", user = "",

password = "", dbname = ""


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.