怎么测试hive jdbc连接
发布网友
发布时间:2022-04-26 17:18
我来回答
共1个回答
热心网友
时间:2022-04-07 17:46
Could not establish connection to localhost:10000/default: java.net.ConnectException: Connection refused
2,简单的Java代码实现;
----通过Class.forName("org.apache.hadoop.hive.jdbc.HiveDriver");加载hive驱动
----通过Connection conn = DriverManager.getConnection("jdbc:hive://localhost:10000/default","","");建立与数据库的连接
eg:
package hive.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;