R Language with JDBC Driver
Table of Contents
Here’s a video to show you how to connect to Treasure Data from R.
You can download the Treasure Data JDBC driver from the link below:
|This driver only works with Treasure Data. It does not work in other environments such as your local Hadoop / Hive cluster.|
Installing the RJDBC Package
First, please install the RJDBC Package as shown below:
$ R > install.packages("RJDBC",dep=TRUE)
To issue queries, please use the RJDBC package together with the Treasure Data JDBC driver.
library(RJDBC) drv <- JDBC("com.treasuredata.jdbc.TreasureDataDriver", "/path/to/td-jdbc-<td-jdbc.version>-jar-with-dependencies.jar", identifier.quote="`") conn <- dbConnect(drv, "jdbc:td://api.treasuredata.com/testdb;type=presto;useSSL=true", "YOUR_USER_NAME_HERE", "YOUR_PASSWORD_HERE") dbListTables(conn) dbGetQuery(conn, "SELECT COUNT(1) AS cnt FROM www_access")
If your account is only Batch(Hive) plan, please change
|RJDBC is required to use Username and Passowrd for authentication. Currently, APIKEY is not supported.|
Last modified: Mar 23 2017 16:15:50 UTC