Forum Stats

  • 3,757,254 Users
  • 2,251,216 Discussions
  • 7,869,779 Comments

Discussions

Unable to Connect R studio to hive using JDBC Driver

4166174
4166174 Member Posts: 1

I have recently switched from windows to unix system and when I try to run my code it gives me an error.

Sys.setenv(JAVA_HOME = "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.221-2.6.18.1.el7.x86_64/")

#set option for Kerberos support. If not set, only login with usercredentials will work

Sys.setenv(JAVA_TOOL_OPTIONS="-Djavax.security.auth.useSubjectCredsOnly=false")

library("DBI")

library("rJava")

library("RJDBC")

cp=c("/opt/hadoop/java/hadoop-auth-2.7.3.2.6.5.0-292.jar"

     ,"/opt/hadoop/java/hadoop-common-2.7.3.2.6.5.0-292.jar"

     ,"/opt/hadoop/java/hive-jdbc-1.2.1000.2.6.5.0-292-standalone.jar"

)

.jinit(classpath=cp)

drv <- JDBC("org.apache.hive.jdbc.HiveDriver",

            cp,

           identifier.quote="`")

conn <-dbConnect(drv,"jdbc:hive2://url")

The error is -

an 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Supplied authorities: url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Resolved authority: url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.HiveConnection openTransport

INFO: Will try to open client transport with JDBC Uri: url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Supplied authorities:url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.Utils parseURL

INFO: Resolved authority:url

Jan 08, 2020 4:09:24 PM org.apache.hive.jdbc.HiveConnection openTransport

INFO: Will try to open client transport with JDBC Uri:url

Error in .jcall([email protected], "Ljava/sql/Connection;", "connect", as.character(url)[1],  :

  java.lang.IllegalArgumentException: java.lang.ClassCastException: java.util.Vector cannot be cast to java.util.Hashtable

I cannot share the url but I believe it's right as it works in windows.

I really appreciate your help.

Tagged:

Answers