Using Oracle database

Hello Community,

I am a novice R user. My question is basic.

I have successfully created a connection to my Oracle database. The datasets appear in the Connections window.

Now, I am unable to access that data.

Here is where I am at now. What is wrong with my code?

Thanks.


con_t2 <- DBI::dbConnect(odbc::odbc(),
                         Driver = "Oracle in OraClient19Home1",
                         DBQ = "t2prod_C",
                         UID = username,
                         PWD = pwd,
                         trusted_connection = TRUE)

T2_Data <- DBI::dbGetQuery(con_t2, query = "T2_PROD")

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

Hi @Sllim

library(DBI)
library(odbc)

con_t2 <- dbConnect(
  odbc::odbc(),
  Driver = "Oracle in OraClient19Home1",
  DBQ = "t2prod_C",
  UID = username,
  PWD = pwd,
  trusted_connection = TRUE
)

T2_Data <- dbGetQuery(con_t2, "SELECT * FROM TableName") # change TableName

Hola @M_AcostaCH

Estoy recibiendo un error similar. Dice que la tabla o vista no existe. Sin embargo, puedo ver el T2_PROD en la ventana Conexiones. Sé que este conjunto de datos existe y que mi acceso es válido.

¿Es cierto que la lista de la ventana Conexiones es la lista de nombres de tabla?

Muchas gracias por su ayuda.

Hi @M_AcostaCH

I am getting a similar error. It says that the table or view does not exist. However, I can see the T2_PROD in the Connections window. I know that this dataset exists and that my access is valid.

Is it true that the list in the Connections window is the list of Table names?

Thanks so much for your help.

> T2_Data <- dbGetQuery(con_t2, "SELECT * FROM T2_PROD") # change TableName

Error: nanodbc/nanodbc.cpp:1769: 42S02: [Oracle][ODBC][Ora]ORA-00942: table or view does not exist
 
<SQL> 'SELECT * FROM T2_PROD'

Hello @M_AcostaCH,
I was able to get it to work using a different package. The problem is solved.

Hola,
pude hacer que funcionara usando un paquete diferente. El problema está resuelto.

1 Like

Hi @Sllim
Maybe you could share the script for help us. :smiling_face:

Hi @M_AcostaCH ,

Finally, I used package that was developed by a colleague at Statistics Canada. It was conceived for internal uses. Unfortunately, it will not work outside our systems.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.