You haven't installed the R package called RPostgreSQL
. It will show the following error:
Error in library("RPostgreSQL") : there is no package called ‘RPostgreSQL’
Calls: source -> withVisible -> eval -> eval -> library
Execution halted
Install the R package called RPostgreSQL
like so:
install.packages("RPostgreSQL")
Problem: The PostgreSQL driver was not properly setted up. It will show the following error:
Error: Couldn't find driver PostgreSQL. Looked in:
* global namespace
* in package called PostgreSQL
* in package called RPostgreSQL
Execution halted
Solution: Still unknown
Problem: The PostgreSQL server was not started. It will show the following error:
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect cherry@localhost:5432 on dbname "database": could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
)
Calls: source ... eval -> dbConnect -> dbConnect -> postgresqlNewConnection
Execution halted
Solution: Start the PostgreSQL server
You may have specified a wrong hostname. The chances are you simply just had a typo. Something like typing locahlost
instead of localhost
. Another reason is that you could have specified a totally wrong hostname and not just a typo. Something like typing localhost
instead of 192.169.1.2
. In any of these reasons, it will show the following error:
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect cherry@locahlost:5432 on dbname "database": could not translate host name "locahlost" to address: nodename nor servname provided, or not known
)
Calls: source ... eval -> dbConnect -> dbConnect -> postgresqlNewConnection
Execution halted
could not translate host name to address
nodename nor servname provided, or not known
Supply the correct hostname. Check the hostname you specified like so:
ping <- function(x, stderr = FALSE, stdout = FALSE, ...) {
pingvec <- system2("ping", paste0("-c1 ",x), stderr = FALSE, stdout = FALSE,...)
if (pingvec == 0) TRUE else FALSE
}
# When the hostname is wrong
ping("locahlost")
[1] FALSE
# When the hostname is correct
ping("localhost")
[1] TRUE
Probably you had a typo. You typed 5342
instead of 5432
.
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect cherry@localhost:5342 on dbname "database": could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5342?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5342?
)
Calls: source ... eval -> dbConnect -> dbConnect -> postgresqlNewConnection
Execution halted
Probably you had a typo. You typed chrery
instead of cherry
.
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect chrery@localhost:5432 on dbname "database": FATAL: role "chrery" does not exist
)
Calls: source ... eval -> dbConnect -> dbConnect -> postgresqlNewConnection
Execution halted
Probably you had a typo. You typed datbaase
instead of database
.
Error in postgresqlNewConnection(drv, ...) :
RS-DBI driver: (could not connect cherry@localhost:5432 on dbname "datbaase": FATAL: database "datbaase" does not exist
)
Calls: source ... eval -> dbConnect -> dbConnect -> postgresqlNewConnection
Execution halted
Error in library("DBI") : there is no package called ‘DBI’
Calls: source -> withVisible -> eval -> eval -> library
Execution halted
Error: fe_sendauth: no password supplied
Execution halted