How to use the Teradata JDBC Driver with teradataR

Connectivity
Connectivity covers the mechanisms for connecting to the Teradata Database, including driver connectivity via JDBC or ODBC.
Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

I am trying to connect to a Teradata 13.10 using a JDBC from R and I getting this message:

> tdConnect("BOKCHOY", uid = "xxxxxx", pwd = "xxxxxx", database="fuzzylogix", dType=c("jdbc"))

Loading required package: RJDBC

Loading required package: DBI

Loading required package: rJava

Error in .jfindClass(as.character(driverClass)[1]) : class not found

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

In the section of the article "Using the R Console, enter the follwing steps below to make a Teradata connection",  step 1 is needed to set the classpath.

Not applicable

Re: How to use the Teradata JDBC Driver with teradataR

Getting the following message when trying to connect to Teradata 13.10 using JDBC from R:

 drv = JDBC("com.teradata.jdbc.TeraDriver","c:\Downloads\TeraJDBC__indep_indep.14.10.00.26\tdgssconfig.jar")

Error in .jfindClass(as.character(driverClass)[1]) : class not found

what's the fix?

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

Please ensure that you have the terajdbc4.jar file as well as the tdgssconfig.jar file defined.

This step is shown in the article:

  1. drv = JDBC("com.teradata.jdbc.TeraDriver","ClasspathForTeradataJDBCDriverFiles") <enter>

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

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

Is there any way to execute statements like "SET" and "DATABASE" through JDBC?

After successfully establishing a connection in variable "conn", when I try to specify a statement like

dbGetQuery(conn, "DATABASE myDB;")

or

dbGetQuery(conn, "SET SESSION SEARCHUIFDBPATH = myDB;")

then I get the error:

Error in .valueClassTest(standardGeneric("fetch"), "data.frame", "fetch") : invalid value from generic function ‘fetch’, class “NULL”, expected “data.frame”

Is there any db* function or any other way JDBC might allow one to run statements like the above?

Thanks,

Alexander.

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

This blog entry by Andreas illustrates how to call JDBC API methods directly.

https://developer.teradata.com/blog/amarek/2013/12/how-to-avoid-duplicate-jdbc-connection-created-by...

You can use this technique to execute any kind of SQL request, including a SQL request that does not return a result set.

Re: How to use the Teradata JDBC Driver with teradataR

Regarding this article:

- It is three years old.  

- There is a comment stating that TeradataR is no longer supported.   

- The link to TeradataR is broken. 

So everything seems to indicate that we should not be using Teradata from an R script.   But I went ahead and gave it a try anyway and it worked.   I did this from Windows 10.

My question is:  Can I trust TeradataR for a production deployment? 

This is what I did to get things working.

1.  As I mentioned above, the link on this page to TeradataR is broken.  So I used a version of teradataR from gitHub:   https://github.com/Teradata/teradataR.

2.  Next I downloaded the JDBC driver.  I used the link shown on this article:  http://downloads.teradata.com/download/connectivity/jdbc-driver.  I placed the driver in c:\temp\terajdbc.

3.  I then went into R Studio and I installed TeradataR by pointing at the downloaded teradataR_1.1.0.tar.gz.

4.  From R Studio I then installed RJDBC from CRAN.

5.  Finally I ran the code below.     

library(RJDBC)

library(teradataR)

jdbc_driver = JDBC("com.teradata.jdbc.TeraDriver","C:\temp\terajdbc\terajdbc4.jar;C:\temp\terajdbc\tdgssconfig.jar")

jdbc_connection = dbConnect(jdbc_driver, "jdbc:teradata://MY_SERVER_NAME/LOGMECH=LDAP", "MY_TERADATA_ID", .rs.askForPassword("Enter password:"))

jdbc_data <- dbGetQuery(jdbc_connection, "SELECT firstname FROM customer;")

dbDisconnect(jdbc_connection)

So everything looks good.   But I don't want to use teradataR in production if Teradata is not currently supporting it.  Please let me know what Teradata's position is on this.

Re: How to use the Teradata JDBC Driver with teradataR

I just tried this out on Linux (Red Hat 7) and it worked there as well.  For any of you trying this out on Linux, please remember (as it is described earlier in this document) that a colon (not a semi-colon) is required to separate the jar paths.  

Windows Example:

jdbc_driver = JDBC("com.teradata.jdbc.TeraDriver","C:\Temp\terajdbc\terajdbc4.jar;C:\Temp\terajdbc\tdgssconfig.jar")

Linux Example (colon instead of semicolon)

drv = JDBC("com.teradata.jdbc.TeraDriver","/Temp/terajdbc/terajdbc4.jar:/Temp/terajdbc/tdgssconfig.jar")

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

Product Management confirmed that teradataR is no longer supported by Teradata.

It is currently available as an open source project on GitHub: https://github.com/Teradata/teradataR

Please note that the teradataR open source project is not supported by Teradata, but I understand that some customers are using it.

I have posted a new article showing how to use the Teradata JDBC Driver with R, omitting any reference to teradataR.

http://developer.teradata.com/connectivity/articles/how-to-use-the-teradata-jdbc-driver-with-r-0