我正在使用 RJDBC 0.2-5 连接到 Rstudio 中的 Hive。我的服务器有 hadoop-2.4.1 和 hive-0.14。我按照下面提到的步骤连接到 Hive。
library(DBI)
library(rJava)
library(RJDBC)
.jinit(parameters="-DrJava.debug=true")
drv <- JDBC("org.apache.hadoop.hive.jdbc.HiveDriver",
c("/home/packages/hive/New folder3/commons-logging-1.1.3.jar",
"/home/packages/hive/New folder3/hive-jdbc-0.14.0.jar",
"/home/packages/hive/New folder3/hive-metastore-0.14.0.jar",
"/home/packages/hive/New folder3/hive-service-0.14.0.jar",
"/home/packages/hive/New folder3/libfb303-0.9.0.jar",
"/home/packages/hive/New folder3/libthrift-0.9.0.jar",
"/home/packages/hive/New folder3/log4j-1.2.16.jar",
"/home/packages/hive/New folder3/slf4j-api-1.7.5.jar",
"/home/packages/hive/New folder3/slf4j-log4j12-1.7.5.jar",
"/home/packages/hive/New folder3/hive-common-0.14.0.jar",
"/home/packages/hive/New folder3/hadoop-core-0.20.2.jar",
"/home/packages/hive/New folder3/hive-serde-0.14.0.jar",
"/home/packages/hive/New folder3/hadoop-common-2.4.1.jar"),
identifier.quote="`")
conHive <- dbConnect(drv, "jdbc:hive://myserver:10000/default",
"usr",
"pwd")
但我总是收到以下错误:
.jcall 中的错误(drv@jdrv,“Ljava/sql/Connection;”,“connect”,as.character(url)[1],:java.lang.NoClassDefFoundError:无法初始化类 org.apache.hadoop.hive .conf.HiveConf$ConfVars
即使我尝试使用不同版本的 Hive jar,Hive-jdbc-standalone.jar 但似乎没有任何效果。我也使用 RHive 连接到 Hive,但也没有成功。
任何人都可以帮助我吗?..我有点卡住了:(