使用JDBC连接R和Teradata(Connect R and Teradata using JDBC)
我正尝试使用RJDBC连接R和Teradata。
我发现这个链接有一个使用mysql的例子,但我很确定如何对teradata做同样的事情。
library(RJDBC)
drv
"/etc/jdbc/mysql-connector-java-3.1.14-bin.jar",
identifier.quote="`")
conn
我知道那里有一个teradataR软件包,但我不知道它是否可以与R 3.0.0一起使用。
目前我只是很有兴趣从数据库中提取数据。 和select * from table一样简单。 问题是RODBC很慢...
是否有其他选择来完成这项任务?
I´m trying to connect R and Teradata using RJDBC.
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
"/etc/jdbc/mysql-connector-java-3.1.14-bin.jar",
identifier.quote="`")
conn
I´ve downloaded this driver: http://downloads.teradata.com/download/connectivity/jdbc-driver But i´m not sure where i should reference the directory.
I know there is a teradataR package out there, but i don´t know if it really works with the R 3.0.0.
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?
原文:https://stackoverflow.com/questions/20998653
更新时间:2019-11-28 22:34
最满意答案
使用R Console,输入以下步骤以建立Teradata连接:
drv = JDBC("com.teradata.jdbc.TeraDriver","ClasspathForTeradataJDBCDriverFiles")
例:
drv = JDBC("com.teradata.jdbc.TeraDriver","c:\\terajdbc\\terajdbc4.jar;c:\\terajdbc\\tdgssconfig.jar")
注:UNIX机器上的路径将使用单个正斜杠来分隔其组件和文件之间的冒号。
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分开。
dbGetQuery(conn,"SQLquery")
例:
dbGetQuery(conn,"select ldap from dbc.sessioninfov where sessionno=session")
Using the R Console, enter the following steps below to make a Teradata connection:
drv = JDBC("com.teradata.jdbc.TeraDriver","ClasspathForTeradataJDBCDriverFiles")
Example:
drv = JDBC("com.teradata.jdbc.TeraDriver","c:\\terajdbc\\terajdbc4.jar;c:\\terajdbc\\tdgssconfig.jar")
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")
Example:
conn = dbConnect(drv,"jdbc:teradata://jdbc1410ek1.labs.teradata.com/TMODE=ANSI,LOGMECH=LDAP","guestldap","passLDAP01")
NOTE: Connection parameters are optional. The first ParameterName is separated from the DatabaseServerName by a forward slash character.
dbGetQuery(conn,"SQLquery")
Example:
dbGetQuery(conn,"select ldap from dbc.sessioninfov where sessionno=session")
2014-01-09
相关问答
我能够使用RODBC包将R连接到Teradata。 如果您正在使用PC并拥有Teradata驱动程序,请按照以下步骤操作。 设置DSN: 转至:控制面板 - >管理工具 - >数据源(ODBC) - >用户DSN选项卡 - >单击添加 - >选择Teradata驱动程序(或您将使用的任何驱动程序。即可能是sql)并按完成。 将弹出一个需要填写的框。需要填写以下字段: 姓名:可以是您想要的任何名称。 例如,我选择了TeraDataRConnection。 名称或IP地址(DBC名称或地址):我的例如
...
我的团队成员提供的解决方案是将两个jar合并成一个jar文件。 完成它并在驱动程序路径中指示新的jar文件后,它按预期工作。 The appropriate way to input multiple jars in the connections page is to separate both fully qualified paths with a comma which you did above. I can confirm this is the approach I took and
...
您是否尝试升级到最新的JDBC驱动程序修补程序版本? 13.10.00.18于2011-04-12发布。 版本13.10.00.15包含一个修补程序,用于纠正多线程并发登录尝试在MIC计算期间抛出GSSException异常:错误的问题。 如果这不能解决问题,并且您的客户/公司是Teradata客户,我会建议您通过Teradata全球支持中心开展事件。 Have you tried upgrading to the latest patch release of the JDBC driver?
...
使用R Console,输入以下步骤以建立Teradata连接: drv = JDBC("com.teradata.jdbc.TeraDriver","ClasspathForTeradataJDBCDriverFiles")
例: drv = JDBC("com.teradata.jdbc.TeraDriver","c:\\terajdbc\\terajdbc4.jar;c:\\terajdbc\\tdgssconfig.jar")
注:UNIX机器上的路径将使用单个正斜杠来分隔其组件
...
使用以下代码并按照其参考文档Teradata Docs Class.forName("com.teradata.jdbc.TeraDriver");
String url=jdbc:teradata://DatabaseServerName
Connection con=DriverManager.getConnection(connection url);
Use the below codes & follow their reference docs Teradata Docs Class
...
就我所知,连接URL应该以/来结束主机名部分 jdbc:teradata://***.***.***.***/tmode=ANSI,charset=UTF8 The connection URL should end the hostname part with / as far as I'm aware jdbc:teradata://***.***.***.***/tmode=ANSI,charset=UTF8
我想到了。 这是解决方案。 Driver = com.teradata.jdbc.TeraDriver 连接字符串 = jdbc:teradata://服务器名/用户名=用户名,密码=密码 问题是连接字符串的语法不正确。 感谢您的投入! I figured it out. Here is the solution. Driver=com.teradata.jdbc.TeraDriver Connection String=jdbc:teradata://servername/USER=userna
...
是。 绝对。 它会工作得很好。 请在下面找到配置。 var config = {
libpath: './jar/terajdbc4.jar',
libs: ['./jar/tdgssconfig.jar'],
drivername: 'com.teradata.jdbc.TeraDriver',
url: 'jdbc:teradata://myteradata.test.com',
// optionally
user: 'sr0898',
...
在我看来,如果你想用PreparedStatement执行它们,你不能为DDL语句指定占位符(我刚刚重新创建了你试图在DDL中创建一个带占位符的简单表的问题)。 It seems to me that you cannot specify placeholders for DDL statements if you want to execute them with PreparedStatement (I've just recreated your problem trying to crea
...
您无法连接DBI包 - 它只定义了DBI兼容包必须实现的接口(思考模板)。 你应该做的是使用RJDBC包 - 它实现了DBI方法。 不要使用RODBC,因为它没有实现DBI方法 - 我猜你需要基于你的问题的DBI。 要使用RJDBC创建与Teradata的连接,您需要执行几个步骤。 您需要来自Teradata的JDBC驱动程序。 您需要成为Teradata的客户才能获得此信息。 如果你下载并查看zip或tar文件,你会发现两个jar文件: terajdbc4.jar tdgssconfig.jar
...