问题
I'm trying to make a connection to PostgreSQL database in R.
I'm writing this
drv <- dbDriver("PostgreSQL")
But in result i have an error:
Error: Couldn't find driver PostgreSQL. Looked in:
* global namespace
* in package called PostgreSQL
* in package called RPostgreSQL
What am I doing wrong?
回答1:
drv <- DBI::dbDriver("PostgreSQL")
gives me the same error but loading RPostgreSQL
library("RPostgreSQL")
before making the connection solves it.
回答2:
Package Issue
drv <- DBI::dbDriver("PostgreSQL")
When you use this code you must include the library that uses the driver package so it wont give you an error please use this code and i am sure it will work
library("RPostgreSQL")
drv <- DBI::dbDriver("PostgreSQL")
and that will solve your issue
来源:https://stackoverflow.com/questions/29755483/connecting-postgresql-with-r