DBI icon indicating copy to clipboard operation
DBI copied to clipboard

dbConnect fails with no error message

Open fnavarro94 opened this issue 2 years ago • 3 comments

I am trying to use DBI to connect to a postgres database. When I use dbConnect() it fails with no error message and outputs some symbols. Not sure what is causing this. Any help will be much appreciated

drv <- dbDriver("PostgreSQL")


dbConnect(drv, host=Sys.getenv('DB_HOST'),
                      port=Sys.getenv('DB_PORT'),
                      dbname=Sys.getenv('DB_NAME'), 
                      user=Sys.getenv('DB_USER'), 
                      password=Sys.getenv('DB_PASSWORD'))

I get that output regardless of the values of host, port, dbname, user and password I use. In fact If I run only this

drv <- dbDriver("PostgreSQL")
dbConnect(drv)

I get the same output.

image

image

fnavarro94 avatar Mar 31 '22 21:03 fnavarro94

Thanks. Can you try reinstalling the RPostgreSQL package, or try with the RPostgres package?

krlmlr avatar Apr 01 '22 07:04 krlmlr

Thanks for the quick responce. I just tried that. I get the same output for both RPostgreSQL and RPostgres

fnavarro94 avatar Apr 01 '22 15:04 fnavarro94

What does the dbConnect() call look like that you use to connect via RPostgres?

krlmlr avatar Apr 15 '22 09:04 krlmlr