Using RPostgreSQL and getting an exception on dbConnect:
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect ...)
Calls: dbConnect -> dbConnect -> postgresqlNewConnection -> .Call
Execution halted
Looking for a way to catch the error reported by the database engine. dbGetexception requires a connection object, so its no use when the connection fails.
Is there a way to throw an error that reports what the error message from the DB engine is, so I know why the connection failed?
All that is needed to generate an error, either with an unavailable server, or bad user or DB name is:
library('RPostgreSQL')
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, host= "***", dbname = "***", user="***")