Skip Headers
Oracle® Big Data Connectors User's Guide
Release 2 (2.1)

Part Number E36961-05
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

orch.connect

Establishes a connection to Oracle Database.

Usage

orch.connect(
        host,
        user,
        sid,
        passwd,
        port, 
        secure,
        driver,
        silent)

Arguments

host

Host name or IP address of the server where Oracle Database is running.

user

Database user name.

sid

System ID (SID) for the Oracle Database instance.

passwd

Password for the database user. If you omit the password, you are prompted for it.

port

Port number for the Oracle Database listener. The default value is 1521.

secure

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

Driver used to connect to Oracle Database (optional). Sqoop is the default driver.

silent

TRUE to suppress the prompts for missing host, user, password, port, and SID values, or FALSE to see them (default).

Usage Notes

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.

Return Value

TRUE for a successful and validated connection, or FALSE for a failed connection attempt

Example

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 load ORCH, 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