Hello,
We are trying to connect our RStudio to hive using the following code:
install.packages("rJava")
install.packages("RJDBC",dep=TRUE)
options( java.parameters = "-Xmx8g" )
library("DBI")
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:<SERVER_NAME>", "user", "pass")
show_databases <- dbGetQuery(conn, "show databases")
show_databases
Currently, I get "java.lang.NoClassDefFoundError: org/apache/thrift/TException", however previously when I reinstalled the packages I got "java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.security.JniBasedUnixGroupsMappingWithFallback"
This seems like an issue with the library not being loaded in the classpath which I am currently debugging. Is there another method to connect RStudio to Hive or has anyone encountered a similar difficulty?
Thanks!