gpt4 book ai didi

RPostgreSQL 访问数据库,错误 : unable to find an inherited method for function "show", 签名 "PostgreSQLConnection"

转载 作者:行者123 更新时间:2023-11-29 11:35:32 26 4
gpt4 key购买 nike

这是一个新的,我在其他 stackoverflow 网站上没有发现任何提及。

所以我在 R 中编程并使用 RPostgreSQL 包访问 Postgres 9.1.5 数据库。因此,我像往常一样创建了与数据库的连接,但现在我收到了一个奇怪的错误。

db.conn = function(){

## This function creates a connection to the database. Subsequent
## functions that access the db will go through this function.
drv = dbDriver("PostgreSQL")
con = dbConnect(drv, user = "user", password = "password", dbname = "dbname", host = "localhost", port = 5432)
return(con)
}

所以当我创建一个对象时:

testdb = db.conn()

对象似乎被创建了,但是当我输入时

testdb

Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "show", for signature "PostgreSQLConnection"

我以前从未见过这个错误。关于它可能来自哪里的任何建议?任何帮助将不胜感激。

最佳答案

请不要交叉发布。我也刚刚在 RPostgreSQL 列表上回复说这对我来说很好用:

R> library(RPostgreSQL)
Loading required package: DBI
R> drv <- dbDriver("PostgreSQL")
R> con <- dbConnect(drv, user = "edd", password = ".....", dbname = "......",
+ host = "localhost", port = 5432)
R> con
<PostgreSQLConnection:(21267,0)>
R>

关于RPostgreSQL 访问数据库,错误 : unable to find an inherited method for function "show", 签名 "PostgreSQLConnection",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12573202/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com