找回密码
 注册
查看: 5179|回复: 0

R语言 RODBC包 odbcConnect()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 22:48:25 | 显示全部楼层 |阅读模式
odbcConnect(RODBC)
odbcConnect()所属R语言包:RODBC

                                        ODBC Open Connections
                                         ODBC打开的连接

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Open connections to ODBC databases.
打开连接到ODBC数据库。


用法----------Usage----------


odbcConnect(dsn, uid = "", pwd = "", ...)

odbcDriverConnect(connection = "", case, believeNRows = TRUE,
                  colQuote, tabQuote = colQuote,
                  interpretDot = TRUE, DBMSencoding = "",
                  rows_at_time = 100, readOnlyOptimize = FALSE)

odbcReConnect(channel, ...)



参数----------Arguments----------

参数:dsn
character string. A registered data source name.
字符的字符串。已登记的数据源名称。


参数:uid, pwd
UID and password for authentication (if required).
UID和密码进行身份验证(如果需要的话)。


参数:connection
character string. See your ODBC documentation for the format.
字符的字符串。请参阅您的ODBC文档的格式。


参数:...
further arguments to be passed to odbcDriverConnect.
进一步的参数被传递到odbcDriverConnect。


参数:case
Controls case changes for different DBMS engines.  See "Details".
控制不同的DBMS引擎的情况下更改。请参阅“详细信息”。


参数:channel
RODBC connection object returned by odbcConnect.
RODBC连接返回的对象odbcConnect。


参数:believeNRows
logical.  Is the number of rows returned by the ODBC connection believable?  Not true for some Oracle and Sybase drivers, apparently, nor for Actual Technologies' SQLite driver for Mac OS X.
逻辑。通过ODBC连接可信返回的行数吗?一些Oracle和Sybase驱动程序不正确的,显然,也没有实际技术SQLite的驱动器的Mac OS X


参数:colQuote, tabQuote
how to quote column (table) names in SQL statements.  Can be of length 0 (no quoting), a length–1 character vector giving the quote character to be used at both ends, or a length–2 character vector giving the beginning and ending quotes. ANSI SQL uses double quotes, but the default mode for a MySQL server is to use backticks.  The defaults are backtick (`) if the DBMS is identified as "MySQL" by the driver, and double quote otherwise. A user reported that the SAS ODBC driver required colQuote = NULL.  
如何在SQL语句中的列(表)名称引用。可以是长度为0(没有引号),长度为1的字符向量的两端使用引号字符,或一个长度为2个字符的矢量提供的开头和结尾的引号。 ANSI SQL使用双引号,但一个MySQL服务器的默认模式是使用反引号。默认值是反引号()被确定为"MySQL"的驱动程序,和双引号,否则如果DBMS。一个用户报告说SAS ODBC驱动程序需要colQuote = NULL。


参数:interpretDot
logical.  Should table names of the form <VAR>qualifier</VAR>.<VAR>table</VAR> be interpreted  as table <VAR>table</VAR> in schema <VAR>qualifier</VAR> (and for MySQL "schema" means database)?
逻辑。如果表名的形式<VAR>qualifier</VAR>.<VAR>table</VAR>被解释为表<VAR>table</VAR>的架构<VAR>qualifier</VAR>(和MySQL的架构“是指数据库)?


参数:DBMSencoding
character string naming the encoding returned by the DBMS.  The default means the encoding of the locale R is running under.  Values other than the default require iconv to  be available: it always is from R 2.10.0, otherwise see capabilities.
DBMS返回的字符串命名的编码。默认的装置在其下运行的区域设置为R的编码。比默认情况下需要iconv是可用的:它始终是从R 2.10.0的值,否则看到的capabilities。


参数:rows_at_time
The default number of rows to fetch at a time, between 1 and 1024.  Not all drivers work correctly with values > 1: see sqlQuery.
默认的行数,一次获取,在1到1024之间。并非所有的驱动器正常工作值> 1:sqlQuery。


参数:readOnlyOptimize
logical: should the connection be optimized for read-only access?
逻辑:连接进行优化的只读访问?


Details

详细信息----------Details----------

odbcConnect establishes a connection to the specified DSN, and odbcDriverConnect allows a more flexible specification via a connection string.  odbcConnect uses the connection string<br> "DSN=<VAR>dsn</VAR>;UID=<VAR>uid</VAR>WD=<VAR>pwd</VAR>",<br> omitting the last two components if they are empty.
odbcConnect建立连接到指定的DSN,odbcDriverConnect允许更灵活的规范,通过一个连接字符串。 odbcConnect使用连接字符串<BR>,"DSN=<VAR>dsn</VAR>;UID=<VAR>uid</VAR>WD=<VAR>pwd</VAR>",参考省略了最后的两个组成部分,如果它们是空的。

For DBMSs that translate table and column names case must be set appropriately.  Allowable values are "nochange", "toupper" and "tolower" as well as the names of databases where the behaviour is known to us (currently "mysql", which maps to lower case on Windows but not on Linux, "postgresql" (lower), and "msaccess" (nochange)).  If case is not specified, the default is "nochange" unless the appropriate value can be figured out from the DBMS name reported by the ODBC driver.  It is likely that "toupper" is desirable on IBM's DB2, but this is not enforced.
对于翻译表名和列名的数据库管理系统,case必须设置适当的。允许的值是"nochange","toupper"和"tolower"的名称以及数据库的行为被称为(目前"mysql",映射到较低的情况下,在Windows上,但在Linux上,"postgresql"(下),和"msaccess"(nochange))。 case如果没有被指定,默认是"nochange"除非适当的值,可以计算出从DBMS的ODBC驱动程序报告的名称。这是可能的,这"toupper"IBM的DB2是可取的,但不是强制的。

Note that readOnlyOptimize may do nothing, and is <STRONG>not</STRONG> guaranteed to enforce read-only access.  With drivers that support it, it is used to optimize locking strategies, transaction management and so on.  It does make access to Mimer read-only, and has no effect on MySQL.
需要注意的是readOnlyOptimize可以什么也不做,<STRONG>不保证</ STRONG>执行只读访问权限。驱动程序支持它,用它来优化锁定的策略,交易管理等。 Mimer只读访问,并在MySQL没有影响。

Function odbcReConnect re-connects to a database using the settings of an existing (and presumably now closed) channel object. Arguments given in the original call can be overridden as needed.
功能odbcReConnect重新连接到一个数据库,利用现有的通道(也可能是现已关闭)对象的设置。根据需要,可以覆盖原来的呼叫中的参数。

Note that if a password is supplied (either as a pwd argument or as part of the DSN) it may be stored in the connection.string element of the return value, but the value is (from RODBC 1.3-0) replaced by ******.  (This will break odbcReConnect.)
请注意,如果提供密码(无论是作为一个pwd参数的DSN的一部分),它可以被存储在connection.string元素的返回值,但该值是(从<X >1.3-0)所取代,RODBC。 (这将打破******。)

If it is possible to set the DBMS or ODBC driver to communicate in the character set of the R session then this should be done.  For example, MySQL can set the communication character set via SQL, e.g. SET NAMES 'utf8'.
如果它是可以设置的DBMS或ODBC驱动程序沟通的R会话字符集,那么应该是这样的。例如,MySQL可以设置通讯字符集,例如通过SQL SET NAMES 'utf8'。


值----------Value----------

A non-negative integer which is used as handle if no error occurred, -1 otherwise.  A successful return has class "RODBC", and attributes including
一个非负整数,它被用作句柄,如果没有发生错误,-1否则。一个成功的回报类"RODBC",和属性,包括


参数:connection.string
the full ODBC connection string.
完整的ODBC连接字符串。


参数:case
the value of case.
值的case。


参数:id
a numeric ID for the channel.
一个数字ID的通道。


参数:believeNRows
the value of believeNRows.
值的believeNRows。


参数:rows_at_time
the value of rows_at_time.
值的rows_at_time。


注意----------Note----------

Several errors which have been reported as bugs in RODBC 1.3-0 which were in fact ODBC driver errors that can be circumvented by setting rows_at_time = 1 (and the warning under that argument has always been there).  The drivers involved have been third-party Oracle drivers and old SQL Server drivers.
的几个错误已被报告为错误的RODBC 1.3-0其实ODBC驱动程序错误,可以规避通过设置rows_at_time = 1(和警告下这样的说法是一直存在的)。涉案司机已被第三方的Oracle驱动程序和旧的SQL Server驱动程序。


(作者)----------Author(s)----------



Michael Lapsley, Brian Ripley




参见----------See Also----------

odbcClose, sqlQuery, odbcGetInfo
odbcClose,sqlQuery,odbcGetInfo


实例----------Examples----------


# MySQL[MySQL的]
channel <- odbcConnect("test", uid="ripley", pwd="secret")
# PostgreSQL: 'case' should be detected automatically[PostgreSQL的:“案例”应该会自动检测]
channel <- odbcConnect("pg", uid="ripley", pwd="secret", case="postgresql")

# re-connection[重新连接]
odbcCloseAll()
channel &lt;- odbcReConnect(channel) # must re-assign as the data may change[必须重新分配的数据可能会改变]


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-25 16:00 , Processed in 0.024514 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表