Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: invalid names for slots of class “Oracle”: ptr, quote, info, encoding #685

Closed
wurzerj opened this issue Dec 16, 2023 · 4 comments · Fixed by #687
Closed

Error: invalid names for slots of class “Oracle”: ptr, quote, info, encoding #685

wurzerj opened this issue Dec 16, 2023 · 4 comments · Fixed by #687

Comments

@wurzerj
Copy link

wurzerj commented Dec 16, 2023

Issue Description

I just installed odbc 1.4.0 from CRAN, but now face problems with Oracle databases. odbc::dbConnect() fails with the above error. Everything works in 1.3.5. Not sure if this is connected to #558, unfortunately I was not able to debug it with the information provided there.

Database

Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production

Reproducible Example

Example (database name and credentials masked):

library(odbc)
library(DBI)
con <- odbc::dbConnect(odbc::odbc(), .connection_string = "DRIVER={Oracle in OraClient11g_home1};DBQ=****;UID=****;PWD=****;")
Session Info
devtools::session_info()

Output:Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.1 (2022-06-23 ucrt)
 os       Windows 10 x64 (build 19044)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  German_Austria.utf8
 ctype    German_Austria.utf8
 tz       Europe/Berlin
 date     2023-12-16
 rstudio  2022.02.3+492 Prairie Trillium (desktop)
 pandoc   NAPackages ───────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.2.1)
 bit           4.0.4   2020-08-04 [1] CRAN (R 4.2.1)
 bit64         4.0.5   2020-08-30 [1] CRAN (R 4.2.1)
 blob          1.2.3   2022-04-10 [1] CRAN (R 4.2.1)
 cachem        1.0.6   2021-08-19 [1] CRAN (R 4.2.1)
 callr         3.7.1   2022-07-13 [1] CRAN (R 4.2.1)
 cli           3.3.0   2022-04-25 [1] CRAN (R 4.2.1)
 crayon        1.5.1   2022-03-26 [1] CRAN (R 4.2.1)
 curl          4.3.2   2021-06-23 [1] CRAN (R 4.2.1)
 DBI         * 1.1.3   2022-06-18 [1] CRAN (R 4.2.1)
 devtools      2.4.4   2022-07-20 [1] CRAN (R 4.2.1)
 digest        0.6.29  2021-12-01 [1] CRAN (R 4.2.1)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.2.1)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.2.1)
 fs            1.5.2   2021-12-08 [1] CRAN (R 4.2.1)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.2.1)
 hms           1.1.1   2021-09-26 [1] CRAN (R 4.2.1)
 htmltools     0.5.3   2022-07-18 [1] CRAN (R 4.2.1)
 htmlwidgets   1.5.4   2021-09-08 [1] CRAN (R 4.2.1)
 httpuv        1.6.5   2022-01-05 [1] CRAN (R 4.2.1)
 keyring       1.3.0   2021-11-29 [1] CRAN (R 4.2.1)
 later         1.3.0   2021-08-18 [1] CRAN (R 4.2.1)
 lifecycle     1.0.1   2021-09-24 [1] CRAN (R 4.2.1)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.1)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.2.1)
 mime          0.12    2021-09-28 [1] CRAN (R 4.2.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.2.1)
 odbc        * 1.4.0   2023-12-15 [1] CRAN (R 4.2.3)
 pkgbuild      1.3.1   2021-12-20 [1] CRAN (R 4.2.1)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.2.1)
 pkgload       1.3.0   2022-06-27 [1] CRAN (R 4.2.1)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.2.1)
 processx      3.7.0   2022-07-07 [1] CRAN (R 4.2.1)
 profvis       0.3.7   2020-11-02 [1] CRAN (R 4.2.1)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.2.1)
 ps            1.7.1   2022-06-18 [1] CRAN (R 4.2.1)
 purrr         0.3.4   2020-04-17 [1] CRAN (R 4.2.1)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.1)
 Rcpp          1.0.9   2022-07-08 [1] CRAN (R 4.2.1)
 remotes       2.4.2   2021-11-30 [1] CRAN (R 4.2.1)
 rlang         1.0.4   2022-07-12 [1] CRAN (R 4.2.1)
 rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.2.1)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.1)
 shiny         1.7.2   2022-07-19 [1] CRAN (R 4.2.1)
 stringi       1.7.8   2022-07-11 [1] CRAN (R 4.2.1)
 stringr       1.4.0   2019-02-10 [1] CRAN (R 4.2.1)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.2.1)
 usethis       2.1.6   2022-05-25 [1] CRAN (R 4.2.1)
 vctrs         0.4.1   2022-04-13 [1] CRAN (R 4.2.1)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.2.1)

 [1] C:/Users/****/AppData/Local/R/win-library/4.2
 [2] C:/Program Files/R/R-4.2.1/library
@hadley
Copy link
Member

hadley commented Dec 17, 2023

Can you please include the output of the code too?

@wurzerj
Copy link
Author

wurzerj commented Dec 18, 2023

@hadley: Sure, that's the output in English locale for your convenience:

Error in initialize(value, ...) : 
invalid names for slots of class “Oracle”: ptr, quote, info, encoding

Here is the full output in my locale:

Error in initialize(value, ...) : 
unzulässige Namen für Slots der Klasse “Oracle”; ptr, quote, info, encoding

And here the full traceback (credentials masked):

8: stop(sprintf(ngettext(sum(is.na(which)), "invalid name for slot of class %s: %s", 
       "invalid names for slots of class %s: %s"), dQuote(Class), 
       paste(snames[is.na(which)], collapse = ", ")), domain = NA)
7: initialize(value, ...)
6: initialize(value, ...)
5: new(info$dbms.name, ptr = ptr, quote = quote, info = info, encoding = encoding)
4: OdbcConnection(dsn = dsn, ..., timezone = timezone, timezone_out = timezone_out, 
       encoding = encoding, bigint = bigint, timeout = timeout, 
       driver = driver, server = server, database = database, uid = uid, 
       pwd = pwd, dbms.name = dbms.name, attributes = attributes, 
       .connection_string = .connection_string)
3: .local(drv, ...)
2: odbc::dbConnect(odbc::odbc(), .connection_string = "DRIVER={Oracle in OraClient11g_home1};DBQ=****;UID=****;PWD=****;")
1: odbc::dbConnect(odbc::odbc(), .connection_string = "DRIVER={Oracle in OraClient11g_home1};DBQ=****;UID=****;PWD=****;")

P.S.: Everything works when trying to connect to a Microsoft SQL Server, but Oracle fails.

@xarrama
Copy link

xarrama commented Dec 18, 2023

I am having the same problem too, after upgrading to odbc 1.4:

con <- DBI::dbConnect(
odbc::odbc(),
"ORACLE_READ",
uid = Sys.getenv("uid"),
pwd = keyring::key_get(service = "oracle", username = "xxx")
)

output error:
Error in initialize(value, ...) :
invalid names for slots of class "Oracle": ptr, quote, info, encoding

@hadley
Copy link
Member

hadley commented Dec 18, 2023

Oh shoot, I made a silly typo 😭. I'll push out a fix ASAP. In the meantime, I think you can use this code to revert to the correct behaviour:

unlockBinding(".__C__Oracle", asNamespace("odbc"))
setClass("Oracle", contains = "OdbcConnection", where = asNamespace("odbc"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants