使用JDBC连接R和Teradata [英] Connect R and Teradata using JDBC

查看:451
本文介绍了使用JDBC连接R和Teradata的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用RJDBC连接R和Teradata.

I´m trying to connect R and Teradata using RJDBC.

我找到了这个链接,其中包含使用mysql的示例,但我不是确定如何对Teradata进行相同操作.

I´ve found this link that has an example using mysql, but i´m nos sure how to do the same with teradata.

library(RJDBC)
drv <- JDBC("com.mysql.jdbc.Driver",
           "/etc/jdbc/mysql-connector-java-3.1.14-bin.jar",
           identifier.quote="`")
conn <- dbConnect(drv, "jdbc:mysql://localhost/test", "user", "pwd")

我已经下载了该驱动程序: http://downloads.teradata.com/download/connectivity/jdbc-driver 但是我不确定应该在哪里引用目录.

I´ve downloaded this driver: http://downloads.teradata.com/download/connectivity/jdbc-driver But i´m not sure where i should reference the directory.

我知道这里有一个teradataR包那儿,但是我不知道它是否真的适用于R 3.0.0.

I know there is a teradataR package out there, but i don´t know if it really works with the R 3.0.0.

暂时,我只是很有趣地将数据从数据库中拉出.就像SELECT * FROM table一样简单.问题是RODBC非常慢...

For the time being i´m just interesting in pulling data out of the database. Something as simple as SELECT * FROM table. The problem is RODBC is very slow...

执行此任务还有其他选择吗?

Are there other options for doing this task?

推荐答案

使用R控制台,在下面输入以下步骤以建立Teradata连接:

Using the R Console, enter the following steps below to make a Teradata connection:

drv = JDBC("com.teradata.jdbc.TeraDriver","ClasspathForTeradataJDBCDriverFiles") 

示例:

drv = JDBC("com.teradata.jdbc.TeraDriver","c:\\terajdbc\\terajdbc4.jar;c:\\terajdbc\\tdgssconfig.jar")  

注意:UNIX计算机上的路径将使用单个正斜杠来分隔其组件和文件之间的冒号.

NOTE: A path on a UNIX machine would use single forward slashes to separate its components and a colon between files.

conn = dbConnect(drv,"jdbc:teradata://DatabaseServerName/ParameterName=Value","User","Password") 

示例:

conn = dbConnect(drv,"jdbc:teradata://jdbc1410ek1.labs.teradata.com/TMODE=ANSI,LOGMECH=LDAP","guestldap","passLDAP01")

注意:连接参数是可选的.第一个ParameterName由正斜杠字符与DatabaseServerName分隔.

NOTE: Connection parameters are optional. The first ParameterName is separated from the DatabaseServerName by a forward slash character.

dbGetQuery(conn,"SQLquery")

示例:

dbGetQuery(conn,"select ldap from dbc.sessioninfov where sessionno=session")

这篇关于使用JDBC连接R和Teradata的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆