Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. library(ROracle)
  2. host <- "xxx.xxx.xx.xxx"
  3. port <- 1521
  4. service <- "K" #? not sure exactly what does it mean service, is it name of server?i cannot really find any informations about it
  5. drv <- dbDriver("Oracle")
  6.  
  7. connect.string <- paste(
  8.  
  9. "(DESCRIPTION=",
  10.  
  11. "(ADDRESS=(PROTOCOL=tcp)(HOST=", host, ")(PORT=", port, "))",
  12.  
  13. "(CONNECT_DATA=(SERVICE_NAME=", service, ")))", sep = "")
  14.  
  15. con <- dbConnect(drv, username = "user", password = "pwd", dbname = connect.string)
  16.  
  17. dbGetInfo(con)
  18.  
  19. $username
  20. [1] "user"
  21.  
  22. $dbname
  23. [1] "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xx.xxx)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=K)))"
  24.  
  25. $serverVersion
  26. [1] "xx.x.x.x.x"
  27.  
  28. $serverType
  29. [1] "Oracle RDBMS"
  30.  
  31. $resTotal
  32. [1] 0
  33.  
  34. $resOpen
  35. [1] 0
  36.  
  37. $prefetch
  38. [1] FALSE
  39.  
  40. $bulk_read
  41. [1] 1000
  42.  
  43. $bulk_write
  44. [1] 1000
  45.  
  46. $stmt_cache
  47. [1] 0
  48.  
  49. $results
  50. list()
  51.  
  52. library(RODBC)
  53. ch <- odbcConnect("K",uid="user", pwd = "pwd") # again question what is the first parameter? should it be server name?
  54. odbcGetInfo(ch)
  55.  
  56. Warnmeldungen:
  57. 1: In odbcDriverConnect("DSN=K;UID=user;PWD=pwd") :
  58. [RODBC] FEHLER: Status IM002, Code 0, Nachricht [unixODBC][Driver Manager]Data source name not found, and no default driver specified
  59. 2: In odbcDriverConnect("DSN=K;UID=user;PWD=pwd") :
  60. ODBC-Verbindung fehlgeschlagen
  61. >
  62. > odbcGetInfo(ch)
  63. Fehler in odbcGetInfo(ch) : Argument ist kein offener RODBC-Kanal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement