Advertisement
Guest User

Untitled

a guest
Oct 13th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. library(odbc)
  2. library(DBI)
  3.  
  4. # dbListTables in a function: gives a warning message
  5.  
  6. dbListTablesTest <- function(dsn, userName, password){
  7.  
  8. con <- dbConnect(
  9. odbc::odbc(),
  10. dsn = dsn,
  11. UID = userName,
  12. PWD = password,
  13. Port = 1433,
  14. encoding = "latin1"
  15. )
  16.  
  17. availableTables <- dbListTables(con)
  18. }
  19.  
  20. availableTables <-
  21. dbListTablesTest(
  22. dsn = "myDsn"
  23. ,userName = myLogin
  24. ,password = myPassword
  25. )
  26.  
  27. # dbListTables not within a function works fine (no warnings)
  28.  
  29. con2 <- dbConnect(
  30. odbc::odbc(),
  31. dsn = "myDsn",
  32. UID = myLogin,
  33. PWD = myPassword,
  34. Port = 1433,
  35. encoding = "latin1"
  36. )
  37.  
  38. availableTables <- dbListTables(con2)
  39.  
  40. warning messages from top-level task callback '1'
  41. Warning message:
  42. Could not notify connection observer. trying to get slot "info" from an object of a basic class ("character") with no slots
  43.  
  44. R version 3.4.2 (2017-09-28)
  45. Platform: x86_64-w64-mingw32/x64 (64-bit)
  46. Running under: Windows 7 x64 (build 7601) Service Pack 1
  47.  
  48. Matrix products: default
  49.  
  50. locale:
  51. [1] LC_COLLATE=Dutch_Belgium.1252 LC_CTYPE=Dutch_Belgium.1252 LC_MONETARY=Dutch_Belgium.1252 LC_NUMERIC=C LC_TIME=Dutch_Belgium.1252
  52.  
  53. attached base packages:
  54. [1] stats graphics grDevices utils datasets tools methods base
  55.  
  56. other attached packages:
  57. [1] DBI_0.7 odbc_1.1.3
  58.  
  59. loaded via a namespace (and not attached):
  60. [1] bit_1.1-12 compiler_3.4.2 hms_0.3 tibble_1.3.4 Rcpp_0.12.13 bit64_0.9-7 blob_1.1.0 rlang_0.1.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement