我正在尝试将我的 hive jdbc客户端连接到hiveserver2。
我正在使用以下行家

<dependency>
  <groupId>org.apache.hive</groupId>
  <artifactId>hive-service</artifactId>
  <version>1.2.1000.2.4.2.12-1</version>
</dependency>

hiveserver2.start() started my hiveserver2.

但是当我用以下代码启动我的jdbc客户端时:
val con: Connection = DriverManager
      .getConnection("jdbc:hive2://localhost:10000/default", "", "")
    val stmt: Statement = con.createStatement
stmt.execute("create table if not exists student (id int))

它给了我以下异常:



任何人都可以帮助我确定此原因或解决方案。

提前致谢。

最佳答案

可能由于多种原因而发生:

  • 相应的jar将不可用,即
    具有正确版本的hivejdbcdriver jar,例如:“hive-jdbc-1.2.1.jar”
    有时您可能会使用
    “hive-jdbc-1.2.1-standalone.jar”(取决于您的用例方式
    是)在librarys文件夹或.m2存储库中。
  • 或者,也可以
    如果 jar 可能没有添加到您的类路径中(为此添加一个条目
    .classpath文件中的jar),具体取决于应用程序的方式
    内置的。
  • 07-24 19:14
    查看更多