JDBC Connection to Hive version 0.14.0 and from R via RDBC package

匆匆过客 提交于 2020-01-06 15:52:12

问题


I am having hiveserver running on a machine1

Following code I have used for JDBC connection

hive_jars <- list.files("/home/jar/hive_jdbc_jar/", 
               pattern = "[.]jar", full.names=FALSE, recursive=TRUE)

lib_dir <- "/home/jar/hive_jdbc_jar/"

hive_class_path <- sprintf( '%s/%s', lib_dir, hive_jars )

.jinit(classpath=hive_class_path, parameters="-DrJava.debug=true")

hostname <- "10.140.224.64"
port <- "10000"
drv <- JDBC( 'org.apache.hadoop.hive.jdbc.HiveDriver',  classPath= hive_class_path, "`" )
server <- sprintf( 'jdbc:hive://%s:%s/default', hostname, port )
hiveconnection <- dbConnect( drv, server )

Error I am getting

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect",    as.character(url)[1],  : 
java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hive.conf.HiveConf$ConfVars

jars i have added

  "antlr-2.7.7.jar" 
  "antlr-runtime-3.4.jar"           "commons-logging-1.1.3.jar"      
  "derby-10.10.1.1.jar"             "hadoop-common-2.4.1.jar"         "hive-exec-0.14.0.jar"           
 "hive-jdbc-0.14.0-standalone.jar" "hive-jdbc-0.14.0.jar"            "hive-metastore-0.14.0.jar"      
"hive-service-0.14.0.jar"         "jdo-api-3.0.1.jar"               "libfb303-0.9.0.jar"             
"libthrift-0.9.0.jar"             "log4j-1.2.16.jar"                "slf4j-api-1.7.5.jar"            
"slf4j-log4j12-1.7.5.jar"

https://cwiki.apache.org/confluence/display/Hive/HiveClient

来源:https://stackoverflow.com/questions/35063755/jdbc-connection-to-hive-version-0-14-0-and-from-r-via-rdbc-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!