Establishes a connection to Oracle Database.
Host name or IP address of the server where Oracle Database is running.
Database user name.
System ID (SID) for the Oracle Database instance.
Password for the database user. If you omit the password, you are prompted for it.
Port number for the Oracle Database listener. The default value is 1521.
Authentication setting for Oracle Database:
TRUE
: You must enter a database password each time you attempt to connect (default).
FALSE
: You must enter a database password only once during a session. The encrypted password is kept in memory and used for subsequent connection attempts.
Driver used to connect to Oracle Database (optional). Sqoop is the default driver.
TRUE
to suppress the prompts for missing host, user, password, port, and SID values, or FALSE
to see them (default).
Use this function when your analysis requires access to data stored in an Oracle database or to return the results to the database.
With an Oracle Advanced Analytics license for Oracle R Enterprise and a connection to Oracle Database, you can work directly with the data stored in database tables and pass processed data frames to R calculations on Hadoop.
You can reconnect to Oracle Database using the connection object returned by the orch.dbcon
function.
TRUE
for a successful and validated connection, or FALSE
for a failed connection attempt
This example installs the ORCH
library and connects to Oracle Database on the local system:
R> library(ORCH) Loading required package: OREbase Attaching package: OREbase The following object(s) are masked from package:base: cbind, data.frame, eval, interaction, order, paste, pmax, pmin, rbind, table Loading required package: OREstats Loading required package: MASS Loading required package: ORCHcore Oracle R Connector for Hadoop 2.0 Hadoop 2.0.0-cdh4.1.2 is up Sqoop 1.4.1-cdh4.1.2 is up OLH 2.0.0 is up R> orch.connect("localhost", "RQUSER", "orcl") Connecting ORCH to RDBMS via [sqoop] Host: localhost Port: 1521 SID: orcl User: RQUSER Enter password for [RQUSER]: password Connected. [1] TRUE
Note:
If you see the message "p with Hadoop MapReduce" when you loadORCH
, then clear the HADOOP_HOME
environment variable. See "Installing the Software on Hadoop."The next example uses a connection object to reconnect to Oracle Database:
R> conn<-orch.dbcon() R> orch.disconnect() Disconnected from a database. R> orch.connect(conn) Connecting ORCH to RDBMS via [sqoop] Host: localhost Port: 1521 SID: orcl User: RQUSER Enter password for [RQUSER]: password Connected [1] TRUE