3.2.1.1 About Using the ore.connect Function
To begin using OML4R, you first connect to a schema in an Oracle Database instance with the ore.connect
function.
Only one OML4R connection can exist at a time during an R session. If an R session is already connected to the database, then invoking ore.connect
terminates the active connection before opening a new connection. Before attempting to connect, you can discover whether an active connection exists by using the ore.is.connected
function.
You explicitly end a connection with the ore.disconnect
function. If you do not invoke ore.disconnect
, then the connection is automatically terminated when the R session ends.
Using the connection type ORACLE, you can do the following:
-
Use the logical
all
argument to specify whether OML4R automatically creates anore.frame
object for each table to which the user has access in the schema and makes thoseore.frame
objects visible in the current R session. Theore.frame
objects contain metadata about the tables. The default value of theall
argument isFALSE
.If
all = TRUE
, then OML4R implicitly invokes theore.sync
andore.attach
functions. Ifall = FALSE
, then the user must explicitly invokeore.sync
to createore.frame
objects. To access these objects by name, the user must invokeore.attach
to include the names in the search path. -
Use either the
conn_string
argument, or various combinations of theuser
,sid
,host
,password
,port
,service_name
, andconn_string
arguments to specify information that identifies the connection.To avoid using a clear-text password, you can specify an Oracle wallet password with the
conn_string
argument. No other arguments are needed. By specifying an Oracle wallet password, you can avoid embedding a database user password in application code, batch jobs, or scripts.With the other connection identifier arguments, you specify a database user name, host name, and password, and either a system identifier (SID) or service name, and, optionally, a TCP port, or you specify a database user name, password, and a
conn_string
argument.The default value of the
port
argument is 1521, the default value ofhost
is"localhost"
, which specifies the local host, and the default value ofconn_string
is NULL. You specify the local host when your R session is running on the same computer as the Oracle Database instance to which you want to connect.
See Also:
-
"Using the ore.connect and ore.disconnect Functions" for examples of using the various connection identifiers
-
Oracle Machine Learning for R Installation and Administration Guide for information on creating an Oracle wallet.
Parent topic: About Connecting to the Database