Connect RStudio with Oracle Database

Hi Developers, welcome to new article of ozanecare. this article i’ll write the queries to connect Rstudio with Oracle Database or R with Oracle Database. The First step we need to
create domain server name (DSN). After creating ,use the dsn inside odbcConnect .let’s see the queries.

Directly Test the below queries into rstudio.

#Install RODBC Package

# Load RODBC package

#Syntax For Connection
#Connection_Name <- odbcConnect("DSN", uid="User_Name", pwd="passwprd",believeNRows=FALSE)

# Example for Create a connection to the database called "conn1"
conn1 <- odbcConnect("HR_Test", uid="HR", pwd="hr",believeNRows=FALSE)

#To Run Oracle Database Table, use sqlQuery
sqlQuery(conn1,'SELECT * FROM HR.COUNTRIES')

# When finished, close the connection (optional)

Happy Queries…Thanks.

Post Author: adama