MINI MINI MANI MO
%
% Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
%
\name{ore.connect}
\alias{ore.is.connected}
\alias{ore.connect}
\alias{ore.disconnect}
\title{
Oracle R Enterprise 连接函数
}
\description{
建立或终止与 Oracle R Enterprise
服务器的连接。
}
\usage{
ore.is.connected(type = c("ORACLE", "HIVE"))
ore.connect(user = "", sid = "", host = "localhost", password = "",
port = NULL, service_name = NULL, conn_string = NULL,
all = FALSE, type = c("ORACLE", "HIVE"),
tzone = Sys.getenv("TZ"), schema = NULL, ...)
ore.disconnect()
}
\arguments{
\item{user}{
使用参数 \code{type = "ORACLE"} (默认值) 时, 则为指定
Oracle 数据库用户名的字符串。
}
\item{sid}{
使用参数 \code{type = "ORACLE"} (默认值) 时, 则为
用于指定 Oracle 数据库 SID 或 Oracle Wallet
连接字符串的字符串。
}
\item{host}{
使用参数 \code{type = "ORACLE"} (默认值) 时, 则为代表
Oracle 数据库主机名的字符串。
}
\item{password}{
使用参数 \code{type = "ORACLE"} (默认值) 时, 则为指定
Oracle 数据库用户口令的字符串。
}
\item{port}{
使用参数 \code{type = "ORACLE"} (默认值) 时, 则为指定
Oracle 数据库端口 (通常为 1521) 的数字。
}
\item{service_name}{
使用参数 \code{type = "ORACLE"} (默认值) 时, 则为用于指定要在
Oracle 数据库连接标识符中使用的
服务名的字符串。
}
\item{conn_string}{
使用参数 \code{type = "ORACLE"} (默认值) 时, 则为
指定用于连接到 Oracle 数据库的连接
字符串。通常用于与 Oracle Wallet 的
数据库连接。
}
\item{all}{
一个逻辑值, 该值指示是否要使用默认参数
调用函数 \code{\link{ore.sync}} 和 \code{\link{ore.attach}}。
这将导致同步并挂接
Oracle R Enterprise 连接的方案中的
所有表和视图。\code{\link{ore.sync}} 的执行时间
随可见表和可见视图数量的增长呈线性增长。
}
\item{type}{
一个用于指定数据库类型的字符串; 可以为
\code{"ORACLE"} (默认值) 或 \code{"HIVE"}。
}
\item{tzone}{
一个用于指定 \R 会话和数据库会话的会话时区的
字符串。\code{tzone} 的默认值为
系统环境变量 \code{TZ} 的值。如果
\code{tzone} 的值为 \code{NA} 或空字符串, \code{UTC} 将
用于 \R 会话和数据库会话。
}
\item{schema}{
一个用于指定方案的字符串。
}
\item{...}{
在不同模式中使用 Hiveserver2 时, Hive 连接的
附加参数, 例如:
\itemize{
\item{使用 Kerberos 验证的 HiveServer2:}{
使用参数 \code{principal} 指定运行 HiveServer2 的主机的
Kerberos 服务器主用户。
}
\item{使用 SSL 的 Hiveserver2:}{
在此模式中, 使用 \code{ssl="true"}, \code{sslTrustStore} 等
参数指定客户机信任存储文件的路径,
并使用 \code{trustStorePassword} 指定信任存储的口令。
}
\item{HiveServer2 的任何其他配置:}{
HiveServer2 可在许多类似的组合中
运行。有关各种模式以及在这些模式下
连接所需的参数, 请查看 Hive 文档。
}
}
}
}
\details{
通常会调用函数 \code{ore.connect} 和 \code{ore.disconnect} 以发挥其
次要作用, 即建立或终止与
Oracle R Enterprise 服务器的连接。必须在所有其他
对 Oracle R Enterprise 函数 (除 \code{ore.connect} 以外) 的调用之前
调用函数 \code{ore.is.connected}。只能有一个活动 Oracle
R Enterprise 连接。可以选择性地调用函数 \code{ore.disconnect} 以
终止 Oracle R Enterprise 会话。\R 会话结束时,
将隐式终止 Oracle R Enterprise 会话。
\R 和数据库会话时区在执行函数 \code{ore.connect}
期间设置。会话时区设置为
参数 \code{tzone} 的值, 该参数的默认值
等于系统环境变量 \code{TZ}。如果未指定 \code{TZ}
和 \code{tzone}, 会话时区将设置为
\code{UTC}。
如果您要使用 Oracle Wallet 存储用户名和口令, 则
使用 \code{conn_string} 参数传递 wallet 映射的
连接字符串 (有关详细信息, 请参阅
Oracle Database Security Guide 中的第 3 章
"Configuring Clients to Use the External Password Store")。此外, \code{service_name} 参数
可用于传递服务名信息。(有关服务名的详细信息, 请参阅
Oracle Database Net Services Administrator's Guide 中的
第 2 章)。
已存在活动 Oracle R Enterprise 连接时, 调用 \code{ore.connect}
将导致先断开活动会话, 然后再启动
新会话。
}
\value{
对于函数 \code{ore.is.connected}, 该值是一个
指示是否存在活动 Oracle R Enterprise
连接的逻辑值; 否则为一个不可见的 \code{NULL} 值。
}
\references{
\href{http://www.oracle.com/technetwork/database/database-technologies/r/r-enterprise/documentation/index.html}{Oracle R Enterprise}
}
\author{
Oracle \email{oracle-r-enterprise@oracle.com}
}
\seealso{
\code{\link{ore.attach}},
\code{\link{ore.exists}},
\code{\link{ore.get}},
\code{\link{ore.ls}},
\code{\link{ore.rm}},
\code{\link{ore.sync}}
}
\examples{
\dontrun{
# pass the username password during connect
if (!is.ore.connected())
ore.connect("rquser", "orcl", "localhost", "rquser")
ore.ls()
ore.disconnect()
# pass the connect string for wallet mode
if (!is.ore.connected())
ore.connect(conn_string = "<wallet_connect_string>")
ore.ls()
ore.disconnect()
}}
\keyword{database}
\keyword{ORE}
OHA YOOOO