## create an Oracle instance and create one connection.
drv <- dbDriver("Oracle")
## use username/password authentication
con <- dbConnect(drv, username = "scott", password = "tiger")
## run an SQL statement by creating first a resultSet object
rs <- dbSendQuery(con, "select * from emp where deptno = 10")
## we now fetch records from the resultSet into a data.frame
data <- fetch(rs) ## extract all rows
dim(data)
## create an Oracle instance and create one connection.
drv <- dbDriver("Oracle")
## use Oracle wallet authentication
con <- dbConnect(drv, username ="", password="",
dbname = "<wallet_connect_string>")
## run an SQL statement by creating first a resultSet object
rs <- dbSendQuery(con, "select * from emp where deptno = 10")
## we now fetch records from the resultSet into a data.frame
data <- fetch(rs) ## extract all rows
dim(data)
## create an Oracle instance and create one connection.
drv <- dbDriver("Oracle")
## connect to a TimesTen IMDB instance using the easy connect
## naming method where SampleDb is a direct driver TimesTen DSN
con <- dbConnect(drv, username ="scott", password="tiger",
dbname = "localhost/SampleDb:timesten_direct")
## run an SQL statement by creating first a resultSet object
rs <- dbSendQuery(con, "select * from dual")
## we now fetch records from the resultSet into a data.frame
data <- fetch(rs) ## extract all rows
dim(data)
## connect to a extproc (this assumes that the driver has already
## been initialized in the embeeded code by passing an external
## pointer representing extproc context)
con <- dbConnect(Extproc())
## run an SQL statement by creating first a resultSet object
rs <- dbSendQuery(con, "select * from dual")
## we now fetch records from the resultSet into a data.frame
data <- fetch(rs) ## extract all rows
dim(data)
Run the code above in your browser using DataLab