2.1.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.
               
With the type argument of ore.connect, you specify the type of connection, either ORACLE or HIVE. A HIVE type of connection connects to Hive tables in a Hadoop cluster. An ORACLE type of connection connects to a schema in an Oracle Database instance. The default value of type is "ORACLE".
               
If the connection type is HIVE, then ore.connect ignores all other arguments. The HIVE option applies only if you are using Oracle Machine Learning for Spark (OML4Spark)  in conjunction with a Hadoop cluster. OML4Spark is part of the Oracle Big Data Connectors option to the Big Data Appliance.
               
If the connection type is ORACLE, then you do the following:
- 
                     
Use the logical
allargument to specify whether OML4R automatically creates anore.frameobject for each table to which the user has access in the schema and makes thoseore.frameobjects visible in the current R session. Theore.frameobjects contain metadata about the tables. The default value of theallargument isFALSE.If
all = TRUE, then OML4R implicitly invokes theore.syncandore.attachfunctions. Ifall = FALSE, then the user must explicitly invokeore.syncto createore.frameobjects. To access these objects by name, the user must invokeore.attachto include the names in the search path. - 
                     
Use either the
conn_stringargument, or various combinations of theuser,sid,host,password,port,service_name, andconn_stringarguments to specify information that identifies the connection.To avoid using a clear-text password, you can specify an Oracle wallet password with the
conn_stringargument. 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_stringargument.The default value of the
portargument is 1521, the default value ofhostis"localhost", which specifies the local host, and the default value ofconn_stringis 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