Search code examples
rr-dbirjdbc

RJDBC: dbReadTable not working


When I upgrade DBI from 0.5.1 to 0.6, whenever I call dbReadTable:

mv = dbReadTable(conn, "MOVIES")
driver = JDBC("oracle.jdbc.OracleDriver", classPath = class_path)n
conn = dbConnect(driver, 
           myhost, 
           username, password)

It will generate an error such as:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘dbGetQuery’ for signature ‘"character", "missing"’
Traceback:

1. dbReadTable(conn, SQL("MOVIES"))
2. dbReadTable(conn, SQL("MOVIES"))
3. .local(conn, name, ...)
4. dbGetQuery(paste0("SELECT * FROM ", sql_name))
5. (function (classes, fdef, mtable) 
 . {
 .     methods <- .findInheritedMethods(classes, fdef, mtable)
 .     if (length(methods) == 1L) 
 .         return(methods[[1L]])
 .     else if (length(methods) == 0L) {
 .         cnames <- paste0("\"", vapply(classes, as.character, 
 .             ""), "\"", collapse = ", ")
 .         stop(gettextf("unable to find an inherited method for function %s for signature %s", 
 .             sQuote(fdef@generic), sQuote(cnames)), domain = NA)
 .     }
 .     else stop("Internal error in finding inherited methods; didn't return a unique method", 
 .         domain = NA)
 . })(list("character", structure("missing", package = "methods")), 
 .     structure(function (conn, statement, ...) 
 .     standardGeneric("dbGetQuery"), generic = structure("dbGetQuery", package = "DBI"), package = "DBI", group = list(), valueClass = character(0), signature = c("conn", 
 .     "statement"), default = `\001NULL\001`, skeleton = (function (conn, 
 .         statement, ...) 
 .     stop("invalid call in method dispatch to 'dbGetQuery' (no default method)", 
 .         domain = NA))(conn, statement, ...), class = structure("standardGeneric", package = "methods")), 
 .     <environment>)
6. stop(gettextf("unable to find an inherited method for function %s for signature %s", 
 .     sQuote(fdef@generic), sQuote(cnames)), domain = NA)

Everything is fine for dbGetQuery. What happens?


Solution

  • This appears to be a problem in the DBI package that will be fixed soon. DBI 0.6-1 and later should not have this problem anymore. Would you mind filing an issue at https://github.com/rstats-db/DBI/issues?