java 读取hive中的文件
在IDEA中
public class Myhive {
public static void main(String[] args) throws Exception{
Class.forName("org.apache.hive.jdbc.HiveDriver");
Connection connection = DriverManager.getConnection("jdbc:hive2://192.168.56.100:10000/mydemo","root","");
PreparedStatement ps = connection.prepareStatement("select * from infos");
ResultSet rs = ps.executeQuery();
while (rs.next()){
System.out.println(rs.getString("name"));
}
rs.close();
ps.close();
connection.close();
}
}