Unable to debug DBI::dbConnect - connection closed unexpectedly by server

I am shifting from a UAT environment to production environment,and in both instances I connect to a postgres database using the following code:

con <- DBI::dbConnect(RPostgres::Postgres(), dbname = "my_db", host = "", port = 5432, user = "my_user", password = "my_password")


  • While this works in UAT, in Production it throws an error of connection being closed unexpectedly/server terminated abnormally before or while processing request
  • I am able to telnet successfully to the host + port
  • I am unable to debug and find out why the connection is closed while using DBI

How can I debug and sort this problem out?
Thank you kind people.

I ran traceback to see if I can debug a little better. But still unable to run debug and see how each line of code acts/which one throws error...

I tried establishing the connection via RJDBC and called traceback() after receiving an error again:

Turns out the network security team had implemented a wrong access policy. Once they assigned the correct one to my account, I was able to connect without errors.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.