Connect R and Teradata using JDBC

I am trying to connect R and Teradata using RJDBC.

I found this link that has an example of using mysql, but I'm not 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") 

I downloaded this driver: http://downloads.teradata.com/download/connectivity/jdbc-driver But I'm not sure where I should link to the directory.

I know that there is a teradataR package there , but I do not know if this really works with R 3.0.0.

For now, I'm just curious to pull data from the database. Something as simple as SELECT * FROM table . The problem is that RODBC is very slow ...

Are there any other options for this task?

+3
source share
1 answer

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 will use separate 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 DatabaseServerName by a forward slash.

 dbGetQuery(conn,"SQLquery") 

Example:

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

Source: https://habr.com/ru/post/1206307/


All Articles