简体   繁体   English

java.sql.SQLException:没有为jdbc找到合适的驱动程序:hive:// localhost:10000 / default

[英]java.sql.SQLException: No suitable driver found for jdbc:hive://localhost:10000/default

I'm new with Hadoop and the ecosystem. 我是Hadoop和生态系统的新手。 I'm trying Hive with JDBC in Java. 我正在用Java中的JDBC尝试Hive。 This is my simple code only to test the driver: 这是我的简单代码,仅用于测试驱动程序:

import java.sql.DriverManager;
import java.sql.SQLException;

public class PrepareHiveTable {
    private static String driverName = "org.apache.hive.jdbc.HiveDriver";

    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName(driverName);
        Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "");
    }
}

I've imported org.apache.hive.jdbc.HiveDriver to the classpath and this is the driver list on my DriverManager : 我已将org.apache.hive.jdbc.HiveDriver导入到类路径中,这是我的DriverManager上的驱动程序列表:

org.apache.calcite.avatica.remote.Driver@45ff54e6
org.apache.calcite.jdbc.Driver@3581c5f3
org.apache.derby.jdbc.AutoloadedDriver40@4f8e5cde
com.mysql.jdbc.Driver@6f75e721
org.apache.hive.jdbc.HiveDriver@69222c14

But when I run the code I get this error: 但是,当我运行代码时,我收到此错误:

Exception in thread "main" java.sql.SQLException: No suitable driver found for 
jdbc:hive://localhost:10000/default
    at java.sql.DriverManager.getConnection(DriverManager.java:689)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at PrepareHiveTable.main(PrepareHiveTable.java:24)
Java Result: 1

Anyone here know how can it happen? 这里的任何人都知道它怎么会发生? And how to solve it? 以及如何解决?

I found the solution. 我找到了解决方案。 I use hive 1.2.1 so I need to write jdbc:hive2://localhost:10000/default instead of jdbc:hive://localhost:10000/default 我使用hive 1.2.1所以我需要编写jdbc:hive2://localhost:10000/default而不是jdbc:hive://localhost:10000/default

thank you 谢谢

I'm using hive-jdbc-1.0.0.jar and I got the connection established successfully to hive db. 我正在使用hive-jdbc-1.0.0.jar ,我已成功建立连接到hive db。 I'm also sharing other details which I used here. 我也在分享我在这里使用的其他细节。

Driver Name: org.apache.hive.jdbc.HiveDriver 驱动程序名称: org.apache.hive.jdbc.HiveDriver
URL: ("jdbc:hive2://localhost:10000/default","username","password") URL :( ("jdbc:hive2://localhost:10000/default","username","password")

Below are the total jars I used for my project to work on hive db from my java project. 下面是我用于项目从我的java项目中处理hive数据库的总罐子。

在此输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.sql.SQLException: 使用 jsp 连接时找不到适合 jdbc:hive2://localhost:10000/default 的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:hive2://localhost:10000/default while connecting using jsp JAVA 10-java.sql.SQLException:找不到适用于jdbc:mysql:// localhost:3306 /错误的驱动程序 - JAVA 10 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ error java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydatabase Android Studio Java MySQL - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydatabase Android Studio Java MySQL java.sql.SQLException:没有为jdbc找到合适的驱动程序:derby:// localhost:1527 / Employees1 - java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/Employees1 引起:java.sql.SQLException:没有为jdbc找到合适的驱动程序:mysql:// localhost:3306 / domain - Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/domain java.sql.SQLException:找不到适用于jdbc:mysql:// localhost:3306的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306 java.sql.SQLException:找不到适用于jdbc的驱动程序:mysql:// localhost / myDB - java.sql.SQLException:No suitable driver found for jdbc:mysql://localhost/myDB java.sql.SQLException:找不到适合jdbc的驱动程序:mysql:// localhost / WORLD - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/WORLD java.sql.SQLException: 找不到适合 jdbc:mysql://localhost:3306/database 的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/database java.sql.SQLException:找不到适用于jdbc:postgresql:// localhost:5432 / testdb的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/testdb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM