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

How to use the Teradata JDBC Driver with teradataR

JDBC support has been added to teradataR version 1.0.1 which provides the ability of using the Teradata JDBC Driver through teradataR to connect to the Teradata database.  teradataR allows R users to easily connect to a Teradata database and use statistical functions directly against the Teradata system without having to extract memory into data.  For more information on teradataR, refer to the teradataR User Guide.

What is R?  R is a language and environment for statistical computing and graphics that runs on UNIX, Windows, and MacOS platforms.

To set up the Teradata JDBC Driver to use with teradataR:

  1. Ensure that you have a Java Runtime Environment (JRE) installed on your client system.  Set the environment variable JAVA_HOME to the directory of the JRE. 
  2. Download and extract the Teradata JDBC Driver to a directory of your choice.  Note the directory of the extracted files as this will be used later to connect to the Teradata database as the ClasspathForTeradataJDBCDriverFiles.
  3. Download and install R[1] from http://www.r-project.org/
  4. Download and install teradataR according to the instructions in the teradataR User Guide

Ensure that the RJDBC, DBI, and rJava packages are installed according to the instructions in the teradataR User Guide in order to use JDBC.

Connect to the Teradata database using a teradataR JDBC session:

  1. Open the RGui
  2. Click on Packages-->Load package…
  3. Select “RJDBC” and click OK
  4. Repeat step #2
  5. Select “teradataR” and click OK

teradataR is now ready to use the Teradata JDBC driver to connect to the Teradata database.

 

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

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

         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.

  1. conn = dbConnect(drv,"jdbc:teradata://DatabaseServerName/ParameterName=Value","User","Password") <enter>

         Example:  conn = dbConnect(drv,"jdbc:teradata://system/TMODE=ANSI","user1","password1")

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

  1. dbGetQuery(conn,"SQLquery") <enter>

         Example: dbGetQuery(conn,"select * from dbc.dbcinfo")

 

To be able to specify JDBC connection URL parameters, use the JDBC and dbConnect commands as shown above instead of the the tdConnect command as specified in the teradataR User Guide.

For further examples of how to use teradataR, refer to the teradataR User Guide.



[1] This article is written using R 2.15.3 for Windows.

R 3.0.1 is not compatible with teradataR 1.0.1 and will return an error stating that teradataR was built before R 3.0.0 when trying to install teradataR.

 


Tags (4)
18 REPLIES
Enthusiast

Re: How to use the Teradata JDBC Driver with teradataR

The R pacackage in general has not had any updates in the last 2 years, any plans on adding more functions and supporting R 3.0.0 and above ?

Senior Supporter

Re: How to use the Teradata JDBC Driver with teradataR

I support this question!

Are there plans to support R 3.0.0? Or if there are no plans to work on this - why not release the source code as open source?

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

Your comments have been forwarded to the teradataR team.  Thanks.

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

Response received:

There are no plans to release new versions of TeradataR.  Instead we are exploring other opportunities with R.  At this point there is no plan to release source code.

Enthusiast

Re: How to use the Teradata JDBC Driver with teradataR

This is very unfortunate.

Can you comment on the "other opportunities"?  Do they involve Revolution R Enterprise?

Enthusiast

Re: How to use the Teradata JDBC Driver with teradataR

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

Thanks for pointing out this link.  Yes, this is the new offering for R.

Senior Supporter

Re: How to use the Teradata JDBC Driver with teradataR

On http://www.teradata.com/News-Releases/2013/Teradata-Offers-First-Fully-Parallel-Scalable-R-Analytics...

This is very interesting but also very different to teradataR as it requires separate licencing.

Teradata Employee

Re: How to use the Teradata JDBC Driver with teradataR

Yes, the offers are different.