Connection to Oracle database

Hello,
I want to do connection with Oracle database through R .
I have installed RODBC package. Could anyone help me with connection string. I have oracle 12 c 64 bit installed on my system

Thank you

1 Like

Hi @Varsha_Khandekar , Im work with Oracle data base and my connection is something like that

library(DBI)
library(rJava)
library(RJDBC) # Java Database Connectivity
# I have problems with other libraries. In my case run always this 3 libraries.

jdbcDriver <- JDBC("oracle.jdbc.OracleDriver", 
                   classPath = "D:\\path\\Documents\\Conexiones\\ojdbc8.jar") # download the .jar file

jdbcConnection <- dbConnect(jdbcDriver, "jdbc:oracle:thin:@//host:port/service_name", "user", "password")
#Establishes a connection to the database using the driver and connection URL provided.

dbListTables(jdbcConnection) # Check the connection run well.

query <- dbGetQuery(jdbcConnection,"SELECT * FROM  YOU_TABLE") 
# if the query is more complex, try to do it in Oracle and then paste it in R to make sure it is right.

head(query) # show first 6 rows of data.

1 Like

This topic was automatically closed 90 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.