Skip to content

Instantly share code, notes, and snippets.

@gbraccialli
Last active November 17, 2015 05:05
Show Gist options
  • Save gbraccialli/3d4ad2ad8d41ec875dd3 to your computer and use it in GitHub Desktop.
Save gbraccialli/3d4ad2ad8d41ec875dd3 to your computer and use it in GitHub Desktop.
options( java.parameters = "-Xmx20g" )
library(rJava)
library(RJDBC)
cp = c("/usr/hdp/current/hive-client/lib/hive-jdbc.jar",
"/usr/hdp/current/hadoop-client/hadoop-common.jar")
.jinit(classpath=cp)
drv <- JDBC("org.apache.hive.jdbc.HiveDriver",
"/usr/hdp/current/hive-client/lib/hive-jdbc.jar",
identifier.quote="`")
conn <- dbConnect(drv, "jdbc:hive2://servername:10000/demo", "user", "password")
show_databases <- dbGetQuery(conn, "show databases")
show_databases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment