I'm new with Hadoop and the ecosystem. I'm trying Hive with JDBC in Java. 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.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?